Commands by bigstupid (3)

  • This find syntax seems a little easier to remember for me when I have to use -prune on AIX's find. It works with gnu find, too. Add whatever other find options after -prune Show Sample Output


    0
    find /some/directory/* -prune -type f -name *.log
    bigstupid · 2014-05-02 00:14:32 1
  • Shows a tree of the disks. Requires "tree" Show Sample Output


    2
    tree /dev/disk
    bigstupid · 2014-04-20 18:56:56 0
  • For a given filesystem return the LUN ID. Command assumes 1:1 relationship between fs:lv:hdisk:lun which may not be the case in all environments. Show Sample Output


    0
    getlunid() { lv=$(df -P $1|grep "^/dev/"|awk '{print $1}'|awk -F/ '{print $3}'); hd=$(lslv -l $lv|tail -1|awk '{print $1}');id=$(odmget -q "name like $hd AND attribute=unique_id" CuAt|grep "value ="|awk -F= '{print $2}'|tr -d '"');echo $id;}
    bigstupid · 2014-04-20 18:43:21 0

What's this?

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.

Share Your Commands


Check These Out

get all Google ipv4 subnets for a iptables firewall for example
a bit shorter, parenthesis not needed but added for clarity

Find installed network devices
Find installed network devices.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Rename files in batch

adjust laptop display hardware brightness [non root]

BIGGEST Files in a Directory
Find biggest files in a directory

shutdown pc in 4 hours without needing to keep terminal open / user logged in.
From the 'disown' man page: disown prevents the current shell from sending a HUP signal to each of the given jobs when the current shell terminates a login session.

Find the package that installed a command

Update twitter via curl

copies 20 most recently downloaded mp3 files (such as from Miro) into a directory
Change ~/tmp to the destination directory, such as your mounted media. Change -n20 to whatever number of files to copy. It should quit when media is full. I use this to put my most recently downloaded podcasts onto my phone.


Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: