Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

locked by voretaq7 Feb 27 '12 at 22:37

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

54 Answers 54

history - shows last used commands
!<number> - executes the command with that number in history


I'm not sure if I am just displaying my ignorance but I just found out about the "last" command for check who has been logging in. It is very useful.

Another good program is "expect". I makes it extremely easy to automate any ssh/telnet logins or anything that forces you to provide input to a program.

Using SSH keys to do automated logins is much more preferred – raspi May 28 '09 at 0:53
it is but when you can't modify the allowed ssh keys on the box you have to use something like expect – bowman May 28 '09 at 4:05

find <blah> -exec <blah> {} \;


find . -iname *20080[123456].log -a ! -iname *.bz2 -exec bzip2 \{\} \;

-exec is useful, but "xargs" gives better performance. More details of the comparison here: – Coops Jun 6 '09 at 14:10
Important: for find+xarg, always use find with -print0, and xargs with -0. Otherwise you can have extremely nasty surprises. – niXar Sep 23 '09 at 9:56

bash history - I normally have 10 or so xterms running. Here is the relavent part of my profile:

# Make history ignore dups, ls, and exit
export HISTIGNORE="&:ls:[bf]g:exit"

# Save 100000 history comamnds
export HISTSIZE=10000

# Make each terminal use a separate history file
SHELLID=$(tty | sed 's!/!.!g')

touch ${HISTFILE}

# load last histfile as current history
history -r $(/bin/ls ${HISTDIR}/history${SHELLID} | /usr/bin/tail -n 1)

If I need to search for a command, I can just grep through my history directory.

aespipe - reads from standard input and writes to standard output. It can be used to create and restore encrypted tar or cpio archives.


logger lets you write messages to syslog from the shell prompt or a script.

logger "See? There! It happened again!"
I just discovered this today – Tom O'Connor Dec 11 '11 at 14:07

A post that I have made on Stack Overflow: How to list only subdirectories in the current one?

ls -d */

It's a simple trick, but you wouldn't know how much time I needed to find that one!


Usually people run their desktop system with X. But you can usually access true text-mode terminal, several of them actually. These are called virtual consoles. You can then normally login and use command-line, etc.

Just hit Ctrl + Alt + F1, Ctrl + Alt + F2, etc. Your X-server is generally running at Ctrl + Alt + F7.

This of course is distribution and configuration dependent.

Also this command to kill the X-server is sometimes useful: Ctrl + Alt + Backspace.

These key combinations work at least on i86 PC's.

ctrl-alt-backspace is disabled on Ubuntu 9.04 (Code name jaunty). Follow this guide if you want to enable it – LiraNuna Jun 22 '09 at 9:34

I find the whereis and which commands handy. Use these when you have alternative versions of the same application with the same name and want to use a specific one of them.


I'm a web dev and our development setup requires me to push files over to our dev server all the time. I wrote a quick wrapper around scp to handle this for me.

I don't think that scp is a hidden feature; it's more like the standard way of pushing files from box to box without nfs. – Kevin M Jun 26 '09 at 15:41
I would recommend using sftp instead of scp for scripting. Scp has some weird behaviour with space in filenames. – niXar Sep 23 '09 at 9:58

The power and flexibility of SSH never cease to amaze me. Also the ability to make a raid array out of anything (floppies, anyone?), all the filesystems available, cool stuff like LVM, the crypto tools, the possibility of crafting your own tools with the myriad of compilers, interpreters, languages... Oh, and not forgetting getting new stuff installed with apt-get or similar.

It is just so much brilliant than windows.

lsof -i - list all opened socket
htop - like top, but with more eye candy
rdiff-backup - for incremental backup
mc - midnight commander 
ethstatus - ethernet statistics
netstat, nmap
iftop - display bandwidth usage on an interface by host

NX combines some of the benefits of screen and ssh -X with clever compression. Now I can run gnumeric remotely over a modem connection and resume it when the connection dies.

Could you give an example on how to use NX as a straight replacement for ssh -X? I don't care for the remote desktop thing, just want to be able to run short-lived apps over a slow connection. The desktop thing is such a bear to config. – niXar Sep 23 '09 at 9:55


e.g. fgrep -r * --include=*.rb

walks the dir structure from the current directory looking for in ruby source files

and is much easier to use than find

ack is another interesting tool for searching in files. It ignores version control files (like .svn -directories) by default and you can tell it to only search in ruby source etc. – ptman May 23 '10 at 17:38
It may be easier on first glance, but, find is much more powerful, and, worth getting to know. find . -type f -name "*.rb" -exec grep <pattern to find> {} \; – Andrew Taylor Jan 19 '11 at 15:21

dd - convert and copy files

I use this very frequently to make copys of DVD's or HDD Patitions that I need to backup.

dd if=/dev/sda2 of=/tmp/copy_of_sda2

it's very handy and configurable, just have a look at it's man page


POSIX Capabilities & File POSIX Capabilities


For "hidden" feature as in most often overlooked or missed by users new to Linux (/Unix).

  • man man
  • man -k <blah> or apropos <blah>

"Hidden" features


My top 5 "hidden" features (hopefully these aren't already up here)

  1. cd - try it out :)
  2. named pipes are not used enough and you can do some really cool stuff with them
  3. system tap, although I'm not great at it and you really need to know your kernel it wields incredible power to the right user.
  4. The combination of piping a list to sort, then to uniq -c and then to sort -n can really work wonders. You can use that to get your top talkers out of an Apache log file or the memory hogs from ps -o.
  5. The proc/sys interface/filesystem. There is so much there that you can adjust/view in real time. Wrapping a cat or grep of statement in watch -d -n 0.1 is awesome and very handy.

Notables are dd, netcat, screen, tcpdump and find but most have been mentioned already.

  • man (gives help on most commands)
  • less (sanely browseable viewing)
  • tail -f (view appended data of a file as it grows)
  • watch (execute a program and view its output periodically full-screen)
I find /usr/bin/most even better than less. Excellent syntax highlighting, among other things. – Matthew Flaschen May 9 '09 at 20:56
tail -F is better than -f; it notices if a file is rotated – niXar May 29 '09 at 9:57
@Matthew: I don't get any syntax highlighting in most by itself, nor do I see any reference to it in the docs. – Dennis Williamson Feb 5 '10 at 3:01
@Dennis, try PAGER=most man ls – Matthew Flaschen Feb 10 '10 at 18:13
@Matthew: That's not syntax highlighting. That's colorization. You can colorize less (including for man pages) by setting the LESS_TERMCAP_* variables. If most prog.c worked, that would be syntax highlighting. – Dennis Williamson Feb 10 '10 at 19:59

I simply can't do without these commands

  • ps -fA (list all running programs
  • lsof (list of open files per process)
  • pushd . (push current directory onto the directory stack)
  • popd . (pop current directory from the directory stack)
  • local account home directory ~/ you can also access a user directory like ~username.
  • replace current bash profile after you've made changes without logging back in. ". ~/.bashrc
  • grep -inR (recursive grep, i = case insensitive, n = show like number, R = recursive)

ctrl + r : searches history for the last command with the letters you specify


Let's see ...

  • I use bash color codes in my /root/.bash_profile to make my root bash prompt a different color than my non-root standard user prompt. Just one more reminder that I'm a single command away from destroying an entire system. ;)

  • I use nc (netcat) a lot to test things. Nice utility with a lot of versatility.

  • For the longest time I never knew that chown could accept both username and groupname together as an argument, i.e.: chown user:group -R /some/directory. That fact has saved me a lot of typing (no more chown/chgrp pairs).

  • The df command's a quick shortcut to see all your mounted filesystems.

  • I use pgrep a lot in scripts to see if a process is running.

  • kexec is pretty neat, lets you reboot without going through BIOS, which shortens reboot times significantly. Don't really reboot a lot, though...

Did you know you can chown user: without a specific group, and, the group will be assigned as the default group of the user specified. – Andrew Taylor Jan 19 '11 at 15:17

find is my greatest tool. I use it to locate things, and execute commands on files or directories found.

No system is complete without ssh too.


Never used script(1) to save a terminal session?
apg(1) to make random passwords
do you want to know how many processors/cores you have? nproc(1)
sfdisk(8) great partition tool
multitail(1) multiple tail at once...great tool


For me, the greatest feature is that nothing is really "hidden" - it's all there right under your eyes if you bother to read the documentation or code.


Not the answer you're looking for? Browse other questions tagged or ask your own question.