Specify the size in bytes using the 'c' option for the -size flag. The + sign reads as "bigger than". Then execute du on the list; sort in reverse mode and show the first 10 occurrences. Show Sample Output
"Sample output" shows a minimalistic configuration file. Show Sample Output
For Mac OS X users only
A shell function using perl to easily convert Unix-time to text. Put in in your ~/.bashrc or equivalent. Tested on Linux / Solaris Bourne, bash and zsh. using perl 5.6 and higher. (Does not require GNU date like some other commands) Show Sample Output
This is a handy way to circumvent the "Maximum line length of 2048 exceeded" grep error.
Once you have run the above command (or put it in your .bashrc), files can be searched using:
lgrep search-string /file/to/search
While it seems (to me at least) a little counter-intuitive to filter on name first, this requires less work for find, as it allows it to immediately discount any files that do not match the name directly from the directory listing on disk. Querying against file attributes requires reading the file attributes, which is performed for all files matching any name based predicates. Show Sample Output
It will highlight non-ascii character in a file. those character can cause problem for some application parsing ascii file.
A web server using $HOME/public_html as user directory is required, $HOME/public_html/shots must exist and have appropriate access rights and $HOSTNAME must be known to and accessible from the outside world. The command uses scrot to create a screen shot, moves it to the screen shot directory, uses xsel to copy the URL to the paste buffer (so that you can paste it with a middle click) and finally uses feh to display a preview of the screen shot. Assign this command to a key combination or an icon in whatever panel you use.
This is a working version, though probably clumsy, of the script submitted by felix001. This works on ubuntu and CygWin. This would be great as a bash function, defined in .bashrc. Additionally it would work as a script put in the path. Show Sample Output
adding users to groups on OS X is not a straightforward process, you need to use the new in built in Directory Service command line utility...
This will check if there are any empty directories, or newly emptied directories, in a list of directories. It will then delete all of those directories. It works with gnu find and OSX/BSD find.
Like the above, but runs a single rm command
This physical volumne - hdisk1 - has TOTAL PPs:11999 (1535872 megabytes) -> 1.5 TB This physical volumne - hdisk1 - has -> 60 GB Show Sample Output
Replace
'/tmp/file 1.txt' '/tmp/file 2.jpg'
with
"$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
for Nautilus script
Or with
%F
for Thunar action
If you linking the symlinks itself, but want to link to source files instead of symlinks, use
"`readlink -m "$i"`"
instead of
"$i"
like this:
for i in '/tmp/file 1.txt' '/tmp/file 2.jpg'; do ln -s "`readlink -m "$i"`" "$i LINK"; done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Show Sample Output
This command is for producing GNU sha256sum-compatible hashes on UNIX systems that don't have sha256sum but do have OpenSSL, such as stock IBM AIX. 1.- Saves a wrapper script for UNIX find that does the following: A.- Feeds a file to openssl on SHA256 hash calculation mode B.- Echoes the output followed by the filename 2.- Makes the file executable 3.- Runs find on a directory, only processing files, and running on each one the wrapper script that calculates SHA256 hashes Pending is figuring out how to verify a sha256sum file on a similar environment. Show Sample Output
This command is used to verify a sha256sum-formatted file hash list on IBM AIX or any other UNIX-like OS that has openssl but doesn't have sha256sum by default. Steps: 1: Save to the filesystem a script that: A: Receives as arguments the two parts of one line of a sha256sum listing B: Feeds a file into openssl on SHA256 standard input hash calculation mode, and saves the result C: Compares the calculated hash against the one received as argument D: Outputs the result in a sha256sum-like format 2: Make the script runnable 3: Feed the sha256sum listing to xargs, running the aforementioned script and passing 2 arguments at a time Show Sample Output
Lists directory size up to a maximum traversal depth on systems like IBM AIX, where the du command doesn't have Linux's --max-depth option. AIX's du uses -g to display directory size on gigabytes, -m to use megabytes, and -k to use kilobytes. tr### is a Perl function that replaces characters and returns the amount of changed characters, so in this case it will return how many slashes there were in the full path name. Show Sample Output
In this example, 192.168.12.50 is the host that should be routed via the VPN and "ppp0" is the name of the VPN network interface (ifconfig shows you the list of network interfaces). Can be a IP or domain name. Show Sample Output
Compare the content of the files in the current directory with files of the same name in the duplicate directory.
Pop Quiz: You have a duplicate of a directory with files of the same name that might differ. What do you do?
You could use diff to compare the directories, but that's boring and it isn't as clever as find -print0 with xargs.
Note: You must omit stderr redirect 2>/dev/null to see the list of missing files from DUPDIR, if any.
Hint: Redirect stderr to a new file to produce a more readable list of files that are missing from DUPDIR.
Warning: This doesn't tell you if DUPDIR contains files not found in the current directory so don't delete DUPDIR.
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: