commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This command is almost the same as 'ls -a', but it does not display the current dir (.) or parent (..)
Requieres unoconv (debian package)
If run in bash, this will display all executables that are in your current $PATH
This command is much quicker than the alternative of "sort | uniq -c | sort -n".
Show only the subdirectories in the current directory. In the example above, /lib has 135 files and directories. With this command, the 9 dirs jump out.
Symlinks all files in the base directory to the target directory then lists all of the created symlinks.
This will show all physically connected SATA (and SCSI) drives on your system. This is particularly useful when troubleshooting hard disks.... or when a mount point seems to be missing.
Find files that are older than x days in the working directory and list them. This will recurse all the sub-directories inside the working directory.
By changing the value for -mtime, you can adjust the time and by replacing the ls command with, say, rm, you can remove those files if you wish to.
Note that the file at the given path will have the contents of the (still) deleted file, but it is a new file with a new node number; in other words, this restores the data, but it does not actually "undelete" the old file.
I posted a function declaration encapsulating this functionality to http://www.reddit.com/r/programming/comments/7yx6f/how_to_undelete_any_open_deleted_file_in_linux/c07sqwe (please excuse the crap formatting).
Many sites with Flash video players will download video files to /tmp on Linux, with temporary filenames like "FlashbGTHm4". These will often play in mplayer, totem, or other movie playing software. You must first navigate to a video page, let it start loading, and then pause playback.
List only hidden files (or directories). You also can use:
ls -lad .*