Commands using cat (476)

What's this? 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

Command to keep an SSH connection open
This runs the uptime command every 30 seconds to avoid an SSH connection dropping due to inactivity. Granted there are better ways of solving this problem but this is sometimes the right tool for the job.

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 symbolic links in current directory
Tested with GNU and BSD ls.

recursive search and replace old with new string, inside files
If you can install rpl it's simpler to use and faster than combinations of find, grep and sed. See man rpl for various options. time on above operation: real 0m0.862s, user 0m0.548s, sys 0m0.180s using find + sed: real 0m3.546s, user 0m1.752s, sys 0m1.580s

Pretty man pages under X
You're a developer - but it doesn't mean you have to slum it! Why not spice up your man page lookups by using a decent PDF viewer. I use 'xpdf' - maybe you prefer acroread, whatever, it's just as fast as plain dull ASCII on today's machines and you can still search for stuff - that's the main reason I use PDF and not PS.

Watch how fast the files in a drive are being deleted
This can be useful when a large remove operation is taking place.

Do the last command, but say 'y' to everything
I doubt this works with other than bash, but then again, I havent tried. The 'yes' utility is very simple, it outputs a hell of a lot of 'y's to standard input. The '!!' command means 'the last command'. So this one-lines inputs a lot of y's into the last command, aggressively agreeing to everything. For instance, when doing apt-get.

Install pip with Proxy
Installs pip packages defining a proxy

processes per user counter
enumerates the number of processes for each user. ps BSD format is used here , for standard Unix format use : ps -eLf |awk '{$1} {++P[$1]} END {for(a in P) if (a !="UID") print a,P[a]}'

Use Dell Service Tag $1 to Find Machine Model [Model Name and Model Number]
255 Max Characters CommandLineFu for $dellurl=''

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.


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: