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

switch case of a text file

Extract the contents of an RPM package to your current directory without installing them.
This assumes you have the 'rpm', 'rpm2cpio' and 'cpio' packages installed. This will extract the contents of the RPM package to your current directory. This is useful for working with the files that the package provides without installing the package on your system. Might be useful to create a temporary directory to hold the packages before running the extraction: $ mkdir /tmp/new-package/; cd /tmp/new-package

Diff XML files
Diffs two xml files by formatting them first using xmllint and then invoking diff. Usage: diffxml XMLFile1 XMLFile2

clear the cache from memory

Escape forward slashes in a variable
For example $ path="/etc/apt/sources.list"; echo ${path//'/'/'\/'} will print $ \/etc\/apt\/sources.list

rsync should continue even if connection lost
Manage partial uploads using append option.

How to secure delete a file
Instead, install apt-get install secure-delete and you can use: -- srm to delete file and directory on hard disk -- smem to delete file in RAM -- sfill to delete "free space" on hard disk -- sswap to delete all data from swap

Know SELinux status
Usefule to check whether SELinux is in force or disabled. Though you need to be superuser while execute this command.

Kill process by pid
To kill a process in windows by using the PID. Change 10728 to the PID of the process you want to kill.

quick and dirty formatting for HTML code
Finds all the closing tags in a HTML document via non-greedy regex and adds a linefeed for easier reading/editing . sed -i.bak -r 's_(/[^>]*?>)_\1\n_g' filename.html . This will save a copy of filename.html as filename.html.bak and then add the linefeeds to the original file


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: