Linux commands to view the history and file content
cat and wc commands with options
kodingwindow@kw:~$ cat kw.c
#include<stdio.h>
int main()
{
    fork();
    printf("Hello, World!\n");
    return 0;
}

kodingwindow@kw:~$ head -1 kw.c | wc -c
18

kodingwindow@kw:~$ wc kw.c
 7 10 90 kw.c

kodingwindow@kw:~$ wc -c kw.c
90 kw.c

kodingwindow@kw:~$ wc -l kw.c
7 kw.c

kodingwindow@kw:~$ wc -L kw.c
30 kw.c

kodingwindow@kw:~$ wc -m kw.c
90 kw.c

kodingwindow@kw:~$ wc -mw kw.c
10 90 kw.c

kodingwindow@kw:~$ wc -w kw.c
10 kw.c

kodingwindow@kw:~$ nl kw.c 1 #include<stdio.h> 2 int main() 3 { 4 fork(); 5 printf("Hello, World!\n"); 6 return 0; 7 }
less, more, od, and xxd commands
kodingwindow@kw:~$ less kw.c
kodingwindow@kw:~$ more kw.c
#include<stdio.h>
int main()
{
    fork();
    printf("Hello, World!\n");
    return 0;
}

kodingwindow@kw:~$ od kw.c 0000000 064443 061556 072554 062544 071474 062164 067551 064056 0000020 005076 067151 020164 060555 067151 024450 075412 020012 0000040 020040 063040 071157 024153 035451 020012 020040 070040 0000060 064562 072156 024146 044042 066145 067554 020054 067527 0000100 066162 020544 067134 024442 005073 020040 020040 062562 0000120 072564 067162 030040 005073 005175 0000132 kodingwindow@kw:~$ xxd kw.c 00000000: 2369 6e63 6c75 6465 3c73 7464 696f 2e68 #include<stdio.h 00000010: 3e0a 696e 7420 6d61 696e 2829 0a7b 0a20 >.int main().{. 00000020: 2020 2066 6f72 6b28 293b 0a20 2020 2070 fork();. p 00000030: 7269 6e74 6628 2248 656c 6c6f 2c20 576f rintf("Hello, Wo 00000040: 726c 6421 5c6e 2229 3b0a 2020 2020 7265 rld!\n");. re 00000050: 7475 726e 2030 3b0a 7d0a turn 0;.}.
cat command with options
kodingwindow@kw:~$ cat kw.c
#include<stdio.h>
int main()
{
    fork();
    printf("Hello, World!\n");
    return 0;
}

kodingwindow@kw:~$ cat -E kw.c
#include<stdio.h>$
int main()$
{$
    fork();$
    printf("Hello, World!\n");$
    return 0;$
}$

kodingwindow@kw:~$ cat -n kw.c
     1  #include<stdio.h>
     2  int main()
     3  {
     4      fork();
     5      printf("Hello, World!\n");
     6      return 0;
     7  }

kodingwindow@kw:~$ cat -b kw.c
     1  #include<stdio.h>
     2  int main()
     3  {
     4      fork();
     5      printf("Hello, World!\n");
     6      return 0;
     7  }
history, tty, stty, mtools commands
kodingwindow@kw:~$ history | tail -6
  127  xxd kw.c
  128  cat kw.c
  129  cat -E kw.c
  130  cat -n kw.c
  131  cat -b kw.c
  132  history | tail -6

kodingwindow@kw:~$ !132
history | tail -6
  128  cat kw.c
  129  cat -E kw.c
  130  cat -n kw.c
  131  cat -b kw.c
  132  history | tail -6
  133  history | tail -6

kodingwindow@kw:~$ tty /dev/pts/3 kodingwindow@kw:~$ stty speed 38400 baud; line = 0; -brkint -imaxbel iutf8 kodingwindow@kw:~$ mtools Supported commands: mattrib, mbadblocks, mcat, mcd, mclasserase, mcopy, mdel, mdeltree mdir, mdoctorfat, mdu, mformat, minfo, mlabel, mmd, mmount mpartition, mrd, mread, mmove, mren, mshowfat, mshortname, mtoolstest mtype, mwrite, mzip kodingwindow@kw:~$
Advertisement