### Commands using col (8) the last day the last week the last month all time sorted by date votes

• You can convert any UNIX man page to .txt

15
man ls | col -b > ~/Desktop/man_ls.txt
· 2009-06-13 11:49:33
• attribution: Thanks to repellent on perlmonks.org source: http://www.perlmonks.org/?node_id=684459

13
cat typescript | perl -pe 's/\e([^]|$.*?[a-zA-Z]|$.*?\a)//g' | col -b > typescript-processed
· 2009-05-28 21:02:17
• Using nroff , it is possible to view the otherwise garbled man page with col command.

2
nroff -u0 -Tlp -man /usr/openwin/man/man1/Xsun.1 | col -x | less
· 2009-02-07 18:40:43
• Place the line above in your ~/.bahsrc file. Now every time you issue the 'vb' command, you invoke the vim editor to edit it, then source it so the changes take effect immediately. Notes: * This mechanism is not working well if your .bashrc contains commands that should not be sourced more than once. * This trick also work for your csh or tclsh users: place the following line in your ~/.cshrc file: alias vc 'vim ~/.cshrc; source ~/.cshrc Thank you adzap for pointing out the missing quote

2
alias vb='vim ~/.bashrc; source ~/.bashrc'
· 2009-03-02 21:01:49

• 0
man perlcheat | col -b > perlcheat.txt
· 2009-07-26 10:16:37
• Something I do a lot is extract columns from some input where cut is not suitable because the columns are separated by not a single character but multiple spaces or tabs. So I often do things like: ... | awk '{print $7,$8}' ... which is a lot of typing, additionally slowed down when typing symbols like '{}$... Using the simple one-line function above makes it easier and faster: ... | col 7 8 How it works: The one-liner defines a new function with name col The function will execute awk, and it expects standard input (coming from a pipe or input redirection) The function arguments are processed with sed to use them with awk: replace all spaces with ,$ so that for example 1 2 3 becomes 1,$2,$3, which is inserted into the awk command to become the well formatted shell command: awk '{print $1,$2,$3}' Allows negative indexes to extract columns relative to the end of the line. Credit: http://www.bashoneliners.com/oneliners/oneliner/144/ Show Sample Output 0 col() { awk '{print$('$(echo$* | sed -e s/-/NF-/g -e 's/ /),$(/g')')}'; } · 2014-06-05 18:01:31 • Dumping man pages to text typically retains certain formatting such as foo^H^H^H___ for underscoring, and reverse-line feeds (not sure why). 'col -bx' removes these. Show Sample Output 0 man2txt() { man "[email protected]" | col -bx ;} · 2018-10-14 01:38:04 • Display man page in plain text -12 man bash | col -b · 2009-09-10 00:45:27 ### 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. ### Check These Out Show a git log with offsets relative to HEAD Print a git log (in reverse order) giving a reference relative to HEAD. HEAD (the current revision) can also be referred to as HEAD~0 The previous revision is HEAD~1 then HEAD~2 etc. . Add line numbers to the git output, starting at zero:$ ... | nl -v0 | ... . Insert the string 'HEAD~' before the number using sed: $... | sed 's/^ \+/&HEAD~/' . Thanks to bartonski for the idea :-) Protect your eye Redshift will adjust the color temperature and protects eye at night -b : will adjust the brightness Find usb device I often use it to find recently added ou removed device, or using find in /dev, or anything similar. Just run the command, plug the device, and wait to see him and only him List open TCP/UDP ports escape any command aliases e.g. if rm is aliased for 'rm -i', you can escape the alias by prepending a backslash: rm [file] # WILL prompt for confirmation per the alias \rm [file] # will NOT prompt for confirmation per the default behavior of the command Get AWS temporary credentials ready to export based on a MFA virtual appliance You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: awk '{ print "export AWS_ACCESS_KEY_ID=\""$1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\""$3 "\"" }' You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials execute your commands hiding secret bits from history records$ wget --user=username --password="\$password" http://example.org/ Instead of hiding commands entirely from history, I prefer to use "read" to put the password into a variable, and then use that variable in the commands instead of the password. Without the "-e" and "-s" it should work in any bourne-type shell, but the -s is what makes sure the password doesn't get echoed to the screen at all. (-e makes editing work a bit better)

Protect directory from an overzealous rm -rf *
Forces the -i flag on the rm command when using a wildcard delete.

Watch the progress of 'dd'
run this in another terminal, were xxxx is the process ID of the running dd process. the progress will report on the original terminal that you ran dd on

grep for minus (-) sign
Use flag "--" to stop switch parsing

### Stay in the loop…

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.

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: