Linux - interesting console commands

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:

sudo !!

will run the last command you typed (!!) with sudo rights.

An even more advanced version: the fuck command

console output of fuck

Display weather information on the console with:


console output of wttr

Display your external IP:

wget -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

console output of fortune | cowsay
espeak "give it a try"
tail /var/log/syslog -n 1 -f | espeak
and wait till something is written to syslog or eg mount a device)
cmatrix | espeak
console output of sl

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: Defaults insults

console output of wrong password

System monitoring tools (which have to be installed):

terminal multiplexer described here:


system monitor:


network monitor (there are several but iftop has a low cpu profile):

sudo iftop

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.

Productivity tools (with vim like syntax):

mail client:


file browser:


python ide:

vim with vundle and jedi as described here


web browser (which compared to elinks supports images)


music player


vim commands:

split screen


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

check with:

vim --version

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 "+y

Paste to vim "+gP or just use middle mouse button or p or shift+insert

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

Dangerous stuff:

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:

console output demonstrating this
You can imagine that you should be really careful with files named "-rf", since this can easily trigger a recoursive delete operation. By the way, try removing the "-i" file from shell.

Also you might want to read about forkbombs for the bash.

To be continued ...