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

Find the biggest files
Also: * find . -type f -exec ls -s {} \; | sort -n -r | head -5 * find . -type f -exec ls -l {} \; | awk '{print $5 "\t" $9}' | sort -n -r | head -5

Unlock more space form your hard drive
This command changes the reserved space for privileged process on '/dev/sda' to 1 per cent.

grep across a git repo and open matching files in gedit

Print every Nth line (to a maximum)
Thanks to knoppix5 for the idea :-) Print selected lines from a file or the output of a command. Usage: $ every NTH MAX [FILE] Print every NTH line (from the first MAX lines) of FILE. If FILE is omitted, stdin is used. The command simply passes the input to a sed script: $ sed -n -e "${2}q" -e "0~${1}p" ${3:-/dev/stdin} print no output $ sed -n quit after this many lines (controlled by the second parameter) $ -e "${2}q" print every NTH line (controlled by the first parameter) $ -e "0~${1}p" take input from $3 (if it exists) otherwise use /dev/stdin ${3:-/dev/stdin}

grep tab (\t)
works in bash

Quickly (soft-)reboot skipping hardware checks
If you are doing some tests which require reboots (e. g. startup skripts, kernel module parameters, ...), this is very time intensive, if you have got a hardware with a long pre-boot phase due to hardware checks. At this time, kexec can help, which only restarts the kernel with all related stuff. First the kernel to be started is loaded, then kexec -e jumps up to start it. Is as hard as a reboot -f, but several times faster (e. g. 1 Minute instead of 12 on some servers here).

faster version of ls *
I know its not much but is very useful in time consuming scripts (cron, rc.d, etc).

Display top Keywords from history

Find status of all symlinks
The symlinks command can show status of all symbolic links, including which links are dangling, which symlinks point to files on other file systems, which symlinks use ../ more than necessary, which symlinks are messy (e.g. having too many slashes or dots), etc. Other useful things it can do include removing all dangling links (-d) and converting absolute links to relative links (-c). The path given must be an absolute path (which is why I used $(pwd) in the example command).

list all file-types (case-insensitive extensions) including subdirectories


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: