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

Silently ensures that a FS is mounted on the given mount point (checks if it's OK, otherwise unmount, create dir and mount)
In my example, the mount point is /media/mpdr1 and the FS is /dev/sdd1 /mountpoint-path = /media/mpdr1 filesystem=/dev/sdd1 Why this command ? Well, in fact, with some external devices I used to face some issues : during data transfer from the device to the internal drive, some errors occurred and the device was unmounted and remounted again in a different folder. In such situations, the command mountpoint gave a positive result even if the FS wasn't properly mounted, that's why I added the df part. And if the device is not properly mounted, the command tries to unmount, to create the folder (if it exists already it will also work) and finally mount the FS on the given mount point.

Gathering all MAC's in your local network
replace eth0 with your ethernet or wireless network interface.

List of all vim features
The above output is for a custom compiled version of Vim on Arch Linux. Just a quick shell one liner, and presents a list of all the enabled and disabled (those prefixed with a '-') features.

Determine status of a RAID write-intent bitmap
Report information about a bitmap file.

Binary clock
displays current time in "binary clock" format (loosely) inspired by: http://www.thinkgeek.com/homeoffice/lights/59e0/ "Decoding": 8421 .... - 1st hour digit: 0 *..* - 2nd hour digit: 9 (8+1) .*.. - 1st minutes digit: 4 *..* - 2nd minutes digit: 9 (8+1) Prompt-command version: PROMPT_COMMAND='echo "10 i 2 o $(date +"%H%M"|cut -b 1,2,3,4 --output-delimiter=" ") f"|dc|tac|xargs printf "%04d\n"|tr "01" ".*"'

Regenerate the /etc/mtab file

Insert the last argument of the previous command
for example if you did a: $ ls -la /bin/ls then $ ls !$ is equivalent to doing a $ ls /bin/ls

Validate all XML files in the current directory and below
If everything validates, there's no output. Can be handy to run on a cron job set up to email output.

Find chronological errors or bad timestamps in a Subversion repository
Lists revisions in a Subversion repository with a timestamp that doesn't follow the revision numbering order. If everything is OK, nothing is displayed.

execute your commands and avoid history records
$ secret_command;export HISTCONTROL= This will make "secret_command" not appear in "history" list.


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: