commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
echo 1 > /proc/sys/sunrpc/nfs_debug && tail -f /var/log/messages
to debug NFS issues.
this function will give you a status webpage code using curl.
get master info:
head -n 40 /home/db_bak.sql |awk '$0~/MASTER_LOG_FILE/
change master ??.
Tested with GNU and BSD ls.
To search for files in /target_directory and all its sub-directories, that have been modified in the last 60 minutes:
find /target_directory -type f -mmin -60
To search for files in /target_directory and all its sub-directories, that have been modified in the last 2 days:
find /target_directory -type f -mtime -2
To search for files in /target_directory and all its sub-directories no more than 3 levels deep, that have been modified in the last 2 days:
find /target_directory -type f -mtime -2 -depth -3
echoprint identify your song, then return artist, song name and album name(release) in a JSON. jq parse it and mp3info set the data in your mp3 file.
of course it depends on:
You need to set the environment variable
You can use it with find, but probably will bypass the 120 request/minute of developer account key. So, use a sleep to do it.
find -name \*.mp3 | while read $f; do eval echo $(echoprint-codegen "$f" | jq ' ..metadata | "mp3info -a \"" + .artist + "\" -t \"" + .title + "\" -l \"" + .release + "\" \"" + .filename + "\"" ' ) | bash; sleep 1; done
Downloads a CRL file, determines the expiration time, and checks when it will expire
Outputs / monitors the content of the LOG_FILE , which matches the SEARCH_STR. The output is cutted by spaces (as delimiter) starting from column 7 till the end.
prints and follows the systemd logfile entires for the DNS bind named.service unit (on Arch linux, your distro bind service may have a different name)
Great for moves, re-installs etc since it is not version specific yet is architecture specific.
Centos yum list is well know for wrapping lines .
Recently in Debian Wheezy the dpkg command refuses to work with wildcards, so this is the one-liner alternative. (alternative to #13614)
command | hl 'regex'
Recently in Debian Wheezy the dpkg command refuses to work with wildcards, so this is the one-liner alternative.
Adds high-performance, lightweight lz4 compression to speed the transfer of files over a trusted network link. Using (insecure) netcat results in a much faster transfer than using a ssh tunnel because of the lack of overhead. Also, LZ4 is as fast or faster than LZ0, much faster than gzip or LZMA, an in a worst-case scenario, incompressible data gets increased by 0.4% in size. Using LZMA or gzip compressors makes more sense in cases where the network link is the bottleneck, whereas LZ4 makes more sense if CPU time is more of a bottleneck.
Improved google text-to-speech function. Allows to specify language, plays sound in terminal. Automatically removes downloaded file after successfully processing.
say LANGUAGE TEXT
say en "This is a test."
say pl "To jest test"
Audio acknowledgement for host availability.
When running the command from a Linux systems, you can use "festival" or "espeak" instead of "say".
Change the scale to adjust number of decimal places
prefix the command with "time" to benchmark the computer (compare how long it takes to calculate 10000 digits of pi on various computers).
Copy a local directory to a remote server using ssh+tar (assume server is lame and does not have rsync).
this will tar/send/untrar a whole directory.