All commands (14,187)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Add temporary swap space
In addition to a swap partition, Linux can also use a swap file. Some programs, like g++, can use huge amounts of virtual memory, requiring the temporary creation of extra space.

Bash function that saves bash functions to file from shell session
The simpler, 1-arg version is save_function(){ { date +"# %F.%T $1; declare -f "$1";}| tee -a ~/.bash_functions; }`

Check tcp-wrapping support
This function returns TRUE if the application supports tcp-wrapping or FALSE if not by reading the shared libraries used by this application.

Make directory including intermediate directories
This will create the intermediate directories that do not exist. I did not know about this for a long time.

print contents of file from line 1 until we match regex
Start printing the contents of filename to stdout, until a matching line to regex is found, then stop.

Join lines
It's works only when you replace '\n' to ONE character.

Define Google Chrome urpmi media source for Mandriva/Mageia (works for both 32-bit and 64-bit systems)
This command adds a urpmi media source called "google-chrome" to the urpmi configuration on Mandriva or Mageia. Needs to be run as root. We specify the option "--update" so that when Google provides a newer version of Google Chrome web browser in their download system then running a system update (eg: "urpmi --auto-update") will result in our copy of Google Chrome getting updated (along with any other Mandriva/Mageia pending updates). To install Google Chrome from this source, use: urpmi google-chrome-stable #install Google chrome web browser

Single use vnc-over-ssh connection
This command 1. SSH into a machine 2. Tunnels VNC port to your local computer ("-L 5900:localhost:5900") 3. Runs a single use vnc server ("x11vnc -safer -localhost -nopw -once -display :0") 4. Goes into the background ("-f") 5. Runs VNC viewer on the local computer connecting to the remote machine via the newly created SSH tunnel ("vinagre localhost:5900")

Dump the root directory to an external hard drive
This will compress the root directory to an external hard drive and split it to parts once it reaches the 4 Gigs file system limit. You can simply restore it with: $ restore ivf /media/My\ Passport/Fedora10bckup/root_dump_fedora

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: