to show any log file or file from head or sorting use head command:
$ head /var/logs/keybagd.log.0 [you see only the head part of the log file]
$ head -n 10 /var/logs/keybagd.log.0 [you can see exact 10th number of line just sorting by using -n]
to show any log file or file from tail or sorting use tail command:
$ tail /var/logs/keybagd.log.0 [you see only the tail part of the log file]
$ tail -n 10 /var/logs/keybagd.log.0 [you can see exact 10th number of line just sorting by using -n]
$ tail -f /var/logs/keybagd.log.0
make two file join by join command:
$ vim file1.txt
$ vim file2.txt
$ join file1.txt file2.txt
word and line count from a log or text file by using wc and nl command :
$ wc fileName.txt or PATH
$ nl fileName.txt or PATH
to sort anything in any file or directory we use grep command:
$ grep fox sampole.txt [grep find fox from this file]
$ grep -i FOX sample.txt [ this -i is getting for case insensitive result]
$ env | grep -i Users [you can use grep with pipe(|) for more sorting] [you get only User info]
here is all command and shortcuts for text editor vim:
go and write file with vim editor:
$ vi fileName.extention
$ vim fileName.extention
to write file in vim do insert mode by uing i in the keyboard:
$ press i button
if you search something unique just use / :
$ /searchWordName
$ go up to down press n
$ down to up press N
vim short cuts :
$ O -- for insert text on previous line
$ o -- for insert text on the next lien
$ a -- for append text after the cursor
$ A -- for append text at the end oif the line
$ x -- for cut the selected text also for deleting characters
$ dd - for delete the current line
$ y -- copy whatever is selected
$ yy - copy the current line
$ p -- paste the copied text before the cursor
$ :w - write and save file
$ :wq - write save and quite from vim
$ :q -- quite from vim
$ :q! - quite out from vim without saving
$ u -- undo your last action
$ ZZ - for :wq but more faster
$ Ctrl+r - redo your last action
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)