Commands by mhoudg (0)

  • bash: commands not found

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

list files recursively by size

Random unsigned integer
works at least in bash. returns integer in range 0-32767. range is not as good, but for lots of cases it's good enough.

Rsync a directory excluding pesky .svn dirs

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

beep when a server goes offline
pings a server once per second, and beeps when the server is unreachable. Basically the opposite of: $ ping -a server-or-ip.com which would beep when a server IS reachable. You could also substitute beep with any command, which makes this a powerful alternative to ping -a: $ while true; do [ "$(ping -c1W1w1 server-or-ip.com 2>/dev/null | awk '/received/ {print $4}')" = 1 ] && date || echo 'server is down!'; sleep 1; done which would output the date and time every sec until the ping failed, in which case it would echo. Notes: Requires beep package. May need to run as root (beep uses the system speaker) Tested on Ubuntu which doesn't have beep out of the box... $ sudo apt-get install beep

Find all the files more than 10MB, sort in descending order of size and record the output of filenames and size in a text file.
This command specifies the size in Kilobytes using 'k' in the -size +(N)k option. The plus sign says greater than. -exec [cmd] {} \; invokes ls -l command on each file and awk strips off the values of the 5th (size) and the 9th (filename) column from the ls -l output to display. Sort is done in reversed order (descending) numerically using sort -rn options. A cron job could be run to execute a script like this and alert the users if a dir has files exceeding certain size, and provide file details as well.

stream a youtube video with mpv where $1 is the youtube link.
opens a new session with video stream

Recursively remove .svn directories

tree command limit depth for recusive directory list
sometimes I need list from path with max limit for recursive depth directory listing

Prepare a commandlinefu command.
This command will format your alias or function to a single line, trimming duplicate white space and newlines and inserting delimiter semi-colons, so it continues to work on a single line.


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: