commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Takes a input file (count.txt) that looks like:
It will add/sum the first column of numbers.
There is no need to 'zcat textfile.gz | less' with newer distros. This is useful for reading archived log files without having to extract, read, and zip when done.
This will print out the files and directories in a gzipped tarball.
Low on disk space? Check the largest installed RPMs for delete canditates.
This command converts filenames with embedded spaces in the current directory replacing spaces with the underscore ("_") character.
This command is a bit Linux specific, as --stdin doesn't exist for passwd on many Unix machines. Further, useradd is high level in most distributions and Unix derivatives except for the Debian family of distros, where adduser would be more appropriate. The last bit, with chage, will force the user to change their password on new login.
NB when you run this gcal command in your shell, holidays are highlighted
but this highlighting does not show in the sample output (above).
To find full details on gcal options: gcal --long-help | less
Example for United States, Pennsylvania:
gcal -K -q US_PA 2009 # display holidays in USA/Pennsylvania for 2009 (with week numbers)
Example for Hong Kong:
gcal -K -q HK 2009 # display holidays in Hong Kong for 2009 (with week numbers)
'visudo' is installed by default on most Unix-like systems. If not installed, you can get it from the 'sudo' package. 'visudo' will use the text editor found in your $EDITOR variable, whether it's vi, vim, emacs, nano or gedit. After making changes to the /etc/sudoers file, visudo will check for syntax errors, and notify you of them. This is better than 'vi /etc/sudoers', because of this capability. Rule #1 of system administration- if there is a tool that exists for editing config files, use the tool.
Merge all pdf files in the directory into one pdf file (the out.pdf file)
Can pipe to tail or change the awk for for file size, groups, users, etc.
Lockstat will sample the kernel 977 times per second, and print out the functions that it sees executing on the CPU during the sample. The -s 10 switch tells lockstsat to not only print that function, but also show the call stack (up to 10 deep).
create tar.bz2 package from files "-type f" modificated today "-mtime -1" in ~/project
rsync from source to dest all between >30
command to turn off your computer when you go home and can not wait
over works like 'more' or 'less', but it pretty print the source code
If you spend most of your time in front of the terminal, leave is a useful reminder. Leave can have absolute form: leave 1555 reminds you to leave at 3:55PM
This command is almost the same as 'ls -a', but it does not display the current dir (.) or parent (..)
-t, --target-directory=DIRECTORY (copy all SOURCE arguments into DIRECTORY).
Display commands and their arguments as they are executed. Useful for debugging shell scripts.
If your customer deletes a file that is still in use by a process, that space does not get freed up (will not show up in df) until that process either closes the file on its own, or is killed.
* size must be 640?480 pixels
* only has 14 colors
* save it in XPM format
Edit /boot/grub/menu.lst and add
make sure for your path name and hard disk