last time edited: 2017-02-22
This is not a post about essential commands! For essential commands you can have a look at the Linux Pocket Guide or The Linux Command Line Beginner's Guide. This is about commands I - having worked with linux for some years now - didn't know about, and after learning about them, found them awesome.
All the years you have been annoyed having forgotten to type sudo... Now the problem simply disappears:
will run the last command you typed (!!) with sudo rights.
An even more advanced version: the fuck command
Display weather information on the console with:
Display your external IP:
wget http://ipinfo.io/ip -qO -
Both of them are candidates for custom commands.
A really helpful set of parameters for du:
du -hsc *
Sometimes it can be a hazzle to exchange files with a colleague on another computer. Connected to the same network? Got python installed? Just type
python -m SimpleHTTPServer
... and your directory (including subfolders) will be provided by the SimpleHTTPServer at yourIP:8000 (for which you might have to set a temporary allow rule in your firewall)
The following commands are more a plaything. Also (therefore) they have to be installed with your package manager:
fortune | cowsay
and wait till something is written to syslog or eg mount a device)
espeak "give it a try"
tail /var/log/syslog -n 1 -f | espeak
cmatrix | espeak
Not strictly a command, but still fun: You can activate insulting "wrong password" messages when promted for sudo password. In your
/etc/sudoers file you have to add:
terminal multiplexer described here:
network monitor (there are several but iftop has a low cpu profile):
fancy version of tail (alternatively you could also give tail -f | espeak a try):
multitail -f /var/log/syslog
(in Arch Linux this would be journalctl -f without any tail)
I usually open a tty, split it with tmux or screen and run the programs above in different sections.
vim with vundle and jedi as described here
web browser (which compared to elinks supports images)
navigation in split screen:
set the following in your .vimrc
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
to achieve easier navigation between split screens with Ctrl+h, Ctrl+j, Ctrl+k, Ctrl+l
open a browsable directory tree in vim
Copying to and from vim
if your vim supports +clipboard and +xterm_clipboard you are ready to go, otherwise you might want to consider installing vim-gtk
Copy from vim to another program
Paste to vim
"+gP or just use middle mouse button or
You could also define your own shortcuts to be able to use ctrl+y (or c) and ctrl+p (or v) with the following entry to your .vimrc
nnoremap <C-y> "+y
nnoremap <C-p> "+gP
I got this from the Unix haters handbook: please look it up there. In short - in Linux you can name files without restrictions. So you can name a file "-i". Now the fun part: if you try to move this file in shell with the mv command this will be recongnized as "mv -i". Also: this will also affect you when deleting all the files in the directory with an asterisk:
Also you might want to read about forkbombs for the bash.
To be continued ...