VimTip (@VimTip) profile picture
Joined February 2012
search case insensitive in all the files recursively for the text "bash" and list the number of occurrences in each file grep -ric bash *
perform operation on all the csv files in the current directory $ for i in `ls *.csv` ; do echo $i; done do what you like instead of echo
CTRL + o : go to previous location in vim CTRL + i : go to next location in vim
2
3
ls -ltr $PWD/* List file names in the current directory with full path
:b2 go to second buffer after :ls (listing all the buffers)
:ls list all the buffers
:wn Save the current buffer and move to the next
:s/\(.*\) \(.*\)/\2 \1/g swap your first name with your last name in Vim - limitless possibilities :)
mkdir -p /a/b/c/d : creates the entire directory structure with folders a, b, c, d
rm -f file[12345].txt : removes file1.txt, file2.txt, file3.txt, file4.txt, file5.txt Try the -i switch if you are feeling merciful
:bn takes you to the next buffer in vim.
!13 : Execute the 13th command from bash history.
One advantage of visually dull environments like the command line or an editor is that there isn't much to do there but work.
6
62
16
“@TipOfBash: Unlock another user's session from root : loginctl list-sessions loginctl unlock-session <session_id>”
"cp filename{,.back}" : Take backup of the file easily. The command expands to "cp filename filename.back"
top -M : see stats in MB/GB format.
Open a list of files that were output of a previous command. For e.g. "find" tinyurl.com/ac2n2mw
Vim is a language if you can understand .. cw change word, c$ change current to end of line ..