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:
The "proportional set size" is probably the closest representation of how much active memory a process is using in the Linux virtual memory stack. This number should also closely represent the %mem found in ps(1), htop(1), and other utilities.
This uses mutt to send the file, and doesn't require uuencode etc
An entirely shell-based solution (should work on any bourne-style shell), more portable on relying on the rename command, the exact nature of which varies from distro to distro.
Info about Bluetooth devices.
Compares the md5 checksums of the contents of two directories, outputting the checksum and filename where any files differ. Shows only the file name, not the full path.
Compute the md5 checksums for the contents of two mirrored directories, then sort and diff the results. If everything matches, nothing is returned. Otherwise, any checksums which do not match, or which exist in one tree but not the other, are returned. As you might imagine, the output is useful only if no errors are found, because only the checksums, not filenames, are returned. I hope to address this, or that someone else will!
Optionally, pipe the output into http://sed.sourceforge.net/grabbag/scripts/html2iso.sed
Or: wget -qO - http://www.asciiartfarts.com/random.cgi | sed -n '//,//p' | sed -n '/
'/tmp/file 1.txt' '/tmp/file 2.jpg'
for Nautilus script
for Thunar action
If you linking the symlinks itself, but want to link to source files instead of symlinks, use
"`readlink -m "$i"`"
for i in '/tmp/file 1.txt' '/tmp/file 2.jpg'; do ln -s "`readlink -m "$i"`" "$i LINK"; done
RU: Найдет число файлов в папке по данной маске в цикле по дням месяца
How to figure out what a program is doing.
-tt detailed timestamps
-f also strace any child processes
-v be very verbose, even with common structures
-o write output to file
-s N capture up to N characters of strings, rather than abbreviating with ...
Batch resize all images to a width of 'X' pixels while maintaing the aspect ratio.
This makes uses of ImageMagick to make life easier.
The above is OK if you not worried about security, as per sshpass man pages:
" The -p option should be considered the least secure of all of sshpass's options. All system users can see the password in the command line with a simple "ps" command."
So, instead what I do is use the -e option:
" -e The password is taken from the environment variable "SSHPASS"."
You need to install "sshpass" for this to work.
apt-get install sshpass
I don't like doing a massive sort on all the directory names just to get a small set of them. the above shows a sorted list of all directories over 1GB. use head as well if you want.
du's "-x" flag limits this to one file system. That's mostly useful when you run it on "/" but don't want "/proc" and "/dev" and so forth. Remember though that it will also exclude "/home" or "/var" if those are separate partitions.
the "-a" option is often useful too, for listing large files as well as large directories. Might be slower.
list the top 15 folders by decreasing size in MB
Another alternative to blkid, lsblk, file -s, cat /proc/paritions, fdisk -l, etc..
This is just a quick and dirty way to play remote audio files *locally* in your PC.
The best way is to mount the remote Music directory into the local FS, say by using sshfs:
sshfs user@remote:/remote/music/dir/ /mnt/other_pc/
This forces a bonded interface to switch to another slave in the bond as its active slave.