tput rmam
will disable line wrapping so that long lines are truncated to width of the terminal ($COLUMNS).
tput smam
will re-enable wrapping.
I've always used tput in bash scripts but I guess it works on the command line too.
Doesn't work in all terminals.
See http://www.gnu.org/software/termutils/manual/termutils-2.0/html_chapter/tput_1.html
Tunneling an SSH session through TOR for anonymity. Using openbsd's netcat. Tested on Ubuntu 14.04 This also works with any proxy type: http, socks4 and socks5 For http proxy, replace -X 5 with -X connect For socks4 proxy, replace -X 5 with -X 4 (DNS leak may occur) Proxy host defined after -x Replace -x localhost:9050 with proxy server of your choice
Useful, when you need to backup/copy/sync a folder over ssh with a non standard port number
Given a list of filenames, one per line, in /tmp/filelist, calculate the total sum disk usage.
Opens the appropriate graphical file browser for the current terminal eg nautlius.
# displays 10 largest files and folders in bytes # last entry is largest # similar output to this: du -sk * | sort -nr | head Show Sample Output
# Usage: ftagmarks TAG BOOKMARKS.JSON
ftagmarks Bash ~/.mozilla/firefox/*.default/bookmarkbackups/bookmarks-*.json
Tag can be partial matching, e.g. input 'Bas' or 'ash' will match 'Bash' tag.
# Exact tag matching:
ftagmark(){ jq -r --arg t "$1" '.children[] as $i|if $i.root == "tagsFolder" then ([$i.children[] as $j|{title: ($j.title), urls: [$j.children[].uri]}]) else empty end|.[] as $k|if $k.title == $t then $k.urls else empty end|.[]?' "$2"; }
Usage: ftagmark TAG BOOKMARKS.JSON
# List all tags:
ftagmarkl(){ jq -r '.children[] as $i | if $i.root == "tagsFolder" then $i.children[].title else empty end' "$1"; }
Usage: ftagmarkl BOOKMARKS.JSON
# Requires: `jq` - must have CLI JSON processor
http://stedolan.github.io/jq
Show Sample Output
I use screenflow to create and edit videos. The default storage for a single video is a folder. If I want to move that someplace, it's easier to zip up the folder and send it. If I'm making a series of short videos, I might have 10 folders. This will go through and make a single bz3 file for EACH folder.
Coming back to a project directory after sometime elsewhere? Need to know what the most recently modified files are? This little function "t" is one of my most frequent commands. I have a tcsh alias for it also: alias t 'ls -ltch \!* | head -20' Show Sample Output
This is an commandline utility to get fair piece of information about the attached network card. Show Sample Output
This is a minimalistic version of the ubiquitious Google definition screen scraper. This version was designed not only to run fast, but to work using BusyBox. BusyBox is a collection of basic Unix tools that have been compiled into a single binary to save space on tiny installations of Unix. For example, although my phone doesn't have perl or the GNU utilities, it does have BusyBox's stripped down versions of wget, tr, and sed. It turns out that those tools suffice for many tasks. Known Bugs: This script does not handle HTML entities at all. I don't think there's an easy way to do that within BusyBox, but I'd love to see it if someone could do it. Also, this script can only define a single word, not phrases. (Well, you could if you typed in %20, but that'd be gross.) Lastly, this script does not show the URL where definitions were found. Given the randomness of the Net, that last bit of information is often key. Show Sample Output
indenting all the files at a time, if the file has local variable for indentation style its even better. This one liner is not pretty but it does the job.
Calculate pi from the infinite series 4/1 - 4/3 + 4/5 - 4/7 + ... This expansion was formulated by Gottfried Leibniz: http://en.wikipedia.org/wiki/Leibniz_formula_for_pi I helped rubenmoran create the sum of a sequence of numbers and he replied with a command for the sequence: 1 + 2 -3 + 4 ... This set me thinking. Transcendental numbers! seq provides the odd numbers 1, 3, 5 sed turns them into 4/1 4/3 4/5 paste inserts - and + bc -l does the calculation Note: 100 million iterations takes quite a while. 1 billion and I run out of memory. Show Sample Output
If you're very busy and don't want to wait for a ping response, use it. This command will be waiting for a successful ping response, to play a sound file to warn you that the target host is available.
Use as normal dd, like:
dcfldd if=/dev/zero of=/dev/null
Other alternatives:
dc3dd
(Quite verbose)
dd if=/dev/zero |pv|dd of=/dev/null
(More verbose)
Show Sample Output
easiest method to kill Google Chrome
Sometimes it is necessary to view debug messages to troubleshoot any SSH connection issues. pass -v (lowercase v) option to the ssh as shown below to view the ssh debug messages. Show Sample Output
Linux only Show Sample Output
Usefull tool for debug process. Show Sample Output
Replace default command in skype.desktop file.
Get http://xkcd.com/now image, inverts colors (I prefer dark backgrounds) and set it as wallpaper. You can replace the "convert" part by "wget -q http://imgs.xkcd.com/comics/now.png -O /tmp/now.png" if you prefer light backgrounds. The DISPLAY variable is here to work as a cron job. Show Sample Output
This is like using cat to see the contents of several small files at once, but using 'more' to add a header to each one.
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: