List files above a given size threshold. Show Sample Output
This command finds the 5 (-n5) most frequently updated logs in /var/log, and then does a multifile tail follow of those log files. Alternately, you can do this to follow a specific list of log files: sudo tail -n0 -f /var/log/{messages,secure,cron,cups/error_log} Show Sample Output
shows also time if its the same year or shows year if installed before actual year and also works if /etc is a link (mac os) Show Sample Output
Comments can be used directly on the command line so I can save in the history a brief description of what command does.
When your wtmp files are being logrotated, here's an easy way to unpack them all on the fly to see more than a week in the past. The rm is the primitive way to prevent symlink prediction attack.
Get simple description on each file from /bin dir, in list form, usefull for newbies. Show Sample Output
If run in bash, this will display all executables that are in your current $PATH Show Sample Output
Substitute spaces in filename with underscore, it work on the first space encountered.
This command list and sort files by size and in reverse order, the reverse order is very helpful when you have a very long list and wish to have the biggest files at the bottom so you don't have scrool up. The file size info is in human readable output, so ex. 1K..234M...3G Tested with Linux (Red Hat Enterprise Edition)
Tested and works on Linux. Show Sample Output
the --time-style argument to 'ls' takes several possible modifiers: full-iso, long-iso, iso, locale, +FORMAT.
The +FORMAT modifier uses the same syntax as date +FORMAT.
--time-style=+"%Y-%m-%d %H:%M:%S" strikes a happy medium between accuracy and verbosity:
ls -lart --time-style=long-iso
doesn't show time down to the nearest second,
ls -lart --time-style=full-iso
displays time to 10E-9 second resolution, but with no significant digits past the full seconds, also showing the timezone:
-rw-r--r-- 1 bchittenden bchittenden 0 2011-02-10 12:07:55.000000000 -0500 bar
Show Sample Output
Works on current directory, with built-in sorting. Show Sample Output
Renames all files in a directory named foo to bar. foobar1 gets renamed to barbar1 barfoo2 gets renamed to barbar2 fooobarfoo gets renamed to barobarfoo NOTE: Will break for files with spaces AND new lines AND for an empty expansion of the glob '*'
This sorts files in multiple directories by their modification date. Note that sorting is done at the end using "sort", instead of using the "-ltr" options to "ls". This ensures correct results when sorting a large number of files, in which case "find" will call "ls" multiple times.
ls -lhR Lists everithing using -l "long listing format" wich includes the space used by the folder. Displays it in -h "human readable form" (i.e. 2.2G, 32K), and -R recurses subfolders. grep -e using a regex, show lines containing the word "total" or a ":" at the end of the line (those with the name of the folder) only. Show Sample Output
(example above is the 'ls' command with reduced output speed)
This command would be useful when it is desirable to list only the directories. 'egrep' chooses only the lines that begin with 'd'. Show Sample Output
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. Show Sample Output
Symlinks all files in the base directory to the target directory then lists all of the created symlinks.
added alias in ~/.bashrc alias lf='find ./* -ctime -1 | xargs ls -ltr --color' Show Sample Output
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.
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
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: