Sometimes there are just no variables such as $DESKTOP_SESSION, $GDMSESSION, or $WINDOWMANAGER. Show Sample Output
shows you the symlinks in the current directory, recursively, but without following them Show Sample Output
forgot to use a pv or rsync and want to know how much has been copied. Show Sample Output
This is a quick way to find what is hogging disk space when you get a full disk alert on your monitoring system. This won't work as is with filesystems that allow embedded spaces in user names or groups (read "Mac OS X attached to a Windows Domain"). In those cases, you will need to change the -k 5 to something that works in your situation. Show Sample Output
Find all files in SVN workspace directories which are uncommitted. List them and find their properties Show Sample Output
https://www.magnatune.com depends on unp but does not need to but unp is the easiest way to unpack any archive. it's in Debian repo's. !note: it deletes flac zip when done, if successful. Show Sample Output
This is much easier to parse and do something else with (eg: automagically create ZFS vols) than anything else I've found. It also helps me keep track of which disks are which, for example, when I want to replace a disk, or image headers in different scenarios. Being able to match a disk to the kernels mapping of said drive the disks serial number is very helpful
ls -l /dev/disk/by-id
Normal `ls` command to list contents of /dev/disk/by-id
grep -v "wwn-"
Perform an inverse search - that is, only output non-matches to the pattern 'wwn-'
egrep "[a-zA-Z]{3}$"
A regex grep, looking for three letters and the end of a line (to filter out fluff)
sed 's/\.\.\/\.\.\///'
Utilize sed (stream editor) to remove all occurrences of "../../"
sed -E 's/.*[0-9]{2}:[0-9]{2}\s//'
Strip out all user and permission fluff. The -E option lets us use extended (modern) regex notation (larger control set)
sed -E 's/->\ //'
Strip out ascii arrows "-> "
sort -k2
Sort the resulting information alphabetically, on column 2 (the disk letters)
awk '{print $2,$1}'
Swap the order of the columns so it's easier to read/utilize output from
sed 's/\s/\t/'
Replace the space between the two columns with a tab character, making the output more friendly
For large ZFS pools, this made creating my vdevs immeasurably easy. By keeping track of which disks were in which slot (spreadsheet) via their serial numbers, I was able to then create my vols simply by copying and pasting the full output of the disk (not the letter) and pasting it into my command. Thereby allowing me to know exactly which disk, in which slot, was going into the vdev. Example command below.
zpool create tank raidz2 -o ashift=12 ata-... ata-... ata-... ata-... ata-... ata-...
Show Sample Output
This is used to find externally accessible network interfaces; interfaces that others can connect to us with. By then finding the IP address of these interfaces, we can find addresses that other hosts would use in order to connect to us. Show Sample Output
from jarmund http://stackoverflow.com/users/1151171/jarmund
Command to run unit tests when source or test files changed.
This command will display the file, but you can change 'cat' to anything else
(type 'n' when prompted to cancel the command or anything else to proceed).
.
Some hints for newbies:
type
unset bar
to make 'bar' function annihilated.
For permanent usage you can put this (bar) function in your .bashrc (for bash) or in .profile (for sh).
With:
. ~/.bashrc
you can get all new inserted functions in .bashrc (so the function 'bar'
or whatever name you choose) immediately available.
Show Sample Output
If there are less than 10 folders, this script will not delete them
find '.odt' files that contain USAGE: grepodt
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: