Commands by spsneo (1)

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

Emulating netcat -e (netcat-traditional or netcat-openbsd) with the gnu-netcat
Then just nc servername 2600 and ./script.sh kill the client with ctrl+c. You can reconnect several times. kill the server with exit

gpg decrypt several files
Change directory (cd) to the directory where all your encrypted files are placed, and then run the command - then you are asked to insert your secret gpg password - ubuntu 8.04

grep for minus (-) sign
Use flag "--" to stop switch parsing

all out
How to force a userid to log out of a Linux host, by killing all processes owned by the user, including login shells:

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Convert embedded spaces in filenames to "_" (underscore)
This command converts filenames with embedded spaces in the current directory replacing spaces with the underscore ("_") character.

Base conversions with bc
Easily convert numbers to their representations in different bases. Passing "ibase=16; obase=8; F2A" to bc will convert F2A (3882 in decimal) from Hex to Octal, and so on.

Size (in bytes) of all RPM packages installed
This command will output the size of all RPM packages and string them together into one enormous addition command which will be calculated by the echo $(( ))

Combine cssh and shell expansion to execute commands on a large cluster
This will open an awful lot of little windows, but is quite useful if you want to quickly patch something on a cluster of servers.

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: