Commands using ps (300)

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

cat large file to clipboard with speed-o-meter
shortest alternative without the speed-o-meter"xclip large.xml" "xclip -o" to get the clipboard content, alternatively [shift key] + insert or middle button of your mouse.

a function to find the fastest DNS server
http://public-dns.info gives a list of online dns servers. you need to change the country in url (br in this url) with your country code. this command need some time to ping all IP in list.

Get the list of root nameservers for a given TLD

Find all clients connected to HTTP or HTTPS ports
It finds, specifically, the connections to the HTTP and HTTPS ports as source ports. You can check for destination ports as well.

Generate hash( of some types) from string
No need to install yet another program when openssl is already installed. :-)

a shell function to print a ruler the width of the terminal window.

Recover deleted Binary files
The above command assumes the lost data is on /dev/sda and you previously issued the following command to mount _another_ disk or partition (/dev/sdb1) on /recovery $sudo mount /dev/sdb1 /recovery If you don't do this, the data could be overwrited! foremost is a very powerful carving tool. By default foremost recovers all known file types. If you want to reduce the amount of files that are recovered you can specify the file type you are looking for. Read the man page to know the available file types. i.e to recover JPEG pictures append to foremost the switch -tjpg

Live filter a log file using grep and show x# of lines above and below

Perl oneliner to print access rights in octal format
This prints file access rights in octal - useful when "stat" is unavailable.

Do command when logged in from certain ips using ssh
Place in ~/.bashrc If you login to a ssh server from different ips, sometimes you want to do something specific for each. e.g., quickly go into screen -x session from a phone, but not your desktop.


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: