Its possible to user a simple regex to extract de username from the finger command. The final echo its optional, just for remove the initial space Show Sample Output
Google Cloud SDK comes with a package manager `gcloud components` but it needs a bit of `sed` to work. Modify the "^| Not" bit to change the package selection. (The gcloud --format option is currently broken) Show Sample Output
This will add a perl POD stub above each method in all modules found recursively in your current directory. The stub will look like: =head2 method_name =cut sub method_name { ...
Find all books on my systems and move them into folder. The -0 switches are to handle spaces etc. in the filenames. Why would you need this? Locate uses an index, so it's super quick, and xargs is more elegant than a for loop.
This approach deals with special characters such as apostrophe and whitespace in the file/directory names. tr '\n' '\0' converts the newline delimiting into NUL delimitering which xargs -0 expects. It works on systems which do not yet support xargs -d or sort -h, and includes files in addition to directories. Show Sample Output
This will look in all binary and library files in package and then search the system for this library and then print the required package that has this file, this depends on /etc/prt-get.conf prtdir order. finddeps is a prt-utils script for http://crux.nu/ CRUX Linux. If you use docker you can try this out with "docker run -i -t crux" Show Sample Output
count all the lines of code in specific directory recursively in this case only *.php can be *.*
Find and delete files over 15 days Show Sample Output
Assumes you are in the branch you want to run the check on. Sub 'develop' for whatever branch you commonly submit PRs to. Show Sample Output
Useful for big systems with lots of cards. (Update: does not work with USB disks)
Just 253 chars of pure UNIX magic, with curl. I created this contrived bash one-liner while building a command-line bash game : www.rubegoldbash.com. Show Sample Output
Finds the date of the first commit in a git repository branch Show Sample Output
Uses "locate" instead of "find", "sort -u" instead of "sort | uniq" and it's case insensitive. Show Sample Output
Removes directories which are less than 1028KB total. This works for systems where blank directories are 4KB. If a directory contains 1 MB (1024KB) or less, it will remove the directory using a path relative to the directory where the command was initially executed (safer than some other options I found).
Adjust the 1028 value for your needs.
It would be helpful to test the results before proceeding with the removal. Simply run all but the last two commands to see a list of what will be removed:
du | awk '{if($1<1028)print;}' | cut -d $'\t' -f 2-
If you're unsure what size a blank folder is, test it like this:
mkdir test; du test; rmdir test
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: