Commands tagged awk (348)

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

Pretty Print a simple csv in the command line
Will handle pretty much all types of CSV Files. The ^M character is typed on the command line using Ctrl-V Ctrl-M and can be replaced with any character that does not appear inside the CSV. Tips for simpler CSV files: * If newlines are not placed within a csv cell then you can replace `map(repr, r)` with r

Get ethX mac addresses
I much prefer using /sbin/ip over /sbin/ifconfig for most everything. I find the interface and output to be much more consistent and it has many abilities that ifconfig, route, etc. do not. To get the mac address for only one interface, add 'show dev [interface]' to the 'ip link' part of the command: ip link show dev eth0 | grep 'link/ether' | awk '{print $2}' . Also, both this command and the ifconfig one do not require root access to run, so the sudo is not necessary.

Purge configuration files of removed packages on debian based systems

Create a new file

List the Sizes of Folders and Directories
I wanted an easy way to list out the sizes of directories and all of the contents of those directories recursively.

Stop Flash from tracking everything you do.
Brute force way to block all LSO cookies on a Linux system with the non-free Flash browser plugin. Works just fine for my needs. Enjoy.

Generate Random Passwords
If you want a password length longer than 6, changing the -c6 to read -c8 will give you 8 random characters instead of 6. To end up with a line-feed, use this with echo: # echo `< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6` Modern systems need higher strenght, so add some special characters: # < /dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8

See all the commits for which searchstring appear in the git diff

Find the package that installed a command

Copy all files. All normal files, all hidden files and all files starting with - (minus).
./* is for copying files starting with - .[!.]* is for copying hidden files and avoiding copying files from the parent directory. ..?* is for copying files starting with .. (avoids the directory ..) /path/to/dir the path to the directory where the files should be copied Can also be used as a script. Input argument is /path/to/dir in tcsh, replace .[!.]* with .[^.]*


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: