It took me a moment to figure out what was going on there (with the whole clippy thing). The bulk of this list is the top commands from commandlinefu which has been on HN before [0], [1].<p>You can even go meta and install a command to let you search commandlinefu [2].<p>[0] <a href="http://news.ycombinator.com/item?id=527486" rel="nofollow">http://news.ycombinator.com/item?id=527486</a><p>[1] <a href="http://news.ycombinator.com/item?id=3843373" rel="nofollow">http://news.ycombinator.com/item?id=3843373</a><p>[2] <a href="http://samirahmed.github.com/fu/" rel="nofollow">http://samirahmed.github.com/fu/</a>
Many years ago, before I ever used Linux in any serious fashion, I often used a password that ended with '!!'. One day I was playing around with setting up MySQL and was having a very hard time with something that seemed super simple. I don't remember exactly how I figured it out, I think I accidentally type my password at the wrong time in the command line and observed some odd behavior and, after hours, finally tracked it to the '!!' command. I decided to try a different root password for MySQL and it was smooth sailing from there. A few months later I was transferring a domain away from a small DNS hosting provider. After a week or so of waiting support told me they were having a hard time with my account and couldn't do what they needed to do to initiate the transfer. I don't have the support emails, must have been my old hotmail account, but something they said suggested they might be trying to run commands on my account with my password (I knew they stored it in plain text since it was in several emails from them and I knew they were Linux servers) and it reminded me about the '!!' issue I had with MySQL. I changed my password and they were able to move forward. I wish I had dug deeper into the issues at the time they occurred.
Check fasd, it will blow your mind, be prepared! :)
Fasd (pronounced similar to "fast") is a command-line productivity booster.<p>I've been using this for a while, and trust me, its changed my command line workflow, and I wish, this should come as inbuilt for all POSIX shells!<p>Here is how it works -<p>If you use your shell to navigate and launch applications, fasd can help you do it more efficiently. With fasd, you can open files regardless of which directory you are in. Just with a few key strings, fasd can find a "frecent" file or directory and open it with command you specify. Below are some hypothetical situations, where you can type in the command on the left and fasd will "expand" your command into the right side. Pretty magic, huh?<p><pre><code> v def conf => vim /some/awkward/path/to/type/default.conf
j abc => cd /hell/of/a/awkward/path/to/get/to/abcdef
m movie => mplayer /whatever/whatever/whatever/awesome_movie.mp4
o eng paper => xdg-open /you/dont/remember/where/english_paper.pdf
vim `f rc lo` => vim /etc/rc.local
vim `f rc conf` => vim /etc/rc.conf
</code></pre>
Fasd offers quick access to files and directories for POSIX shells. It is inspired by tools like autojump, z and v. Fasd keeps track of files and directories you have accessed, so that you can quickly reference them in the command line.<p>The name fasd comes from the default suggested aliases f(files), a(files/directories), s(show/search/select), d(directories).<p>Fasd ranks files and directories by "frecency," that is, by both "frequency" and "recency." The term "frecency" was first coined by Mozilla and used in Firefox.<p>Here is the Link -
<a href="https://github.com/clvv/fasd" rel="nofollow">https://github.com/clvv/fasd</a>
I forgot about the DNS querying of wikipedia. Probably could've used that to entertain myself on my flights over the holidays since I'm pretty sure gogo inflight passes DNS through.<p>Anyway, I'm a big fan of piping things into xargs. xxd is a terminal-based hex editor. It can convert both to and from hex to binary. I also use 'pgrep -lf 'partial_program_name' a lot in place of 'ps aux | grep partial_program_name'. 'pkill -9 partial_program_name' searches for and kills all processes matching the string.
Handy addition to the "mount | column -t" trick:<p>You can use this within Vim to pretty-format text tables, initialization of variables, etc. Just highlight the lines in question in visual line mode (V) and type<p><pre><code> !column -t<CR>
</code></pre>
to pipe the lines through the column command.
a few nice ones here too, <a href="http://www.pixelbeat.org/cmdline.html" rel="nofollow">http://www.pixelbeat.org/cmdline.html</a>, <a href="http://www.pixelbeat.org/docs/linux_commands.html" rel="nofollow">http://www.pixelbeat.org/docs/linux_commands.html</a><p>always worth looking at these types of lists imo, whilst some of the commands mightn't really fit into your workflow or seem useful immediately, they're often exactly the snippets of information that can save hours at a later stage..
I have this in my .bashrc:<p>function lc() { if [[ "$#" -gt 1 ]]; then for DIR in "$@"; do echo -n "$DIR - " ; ls -AU1 $DIR | wc -l ; done ; else ls -AU1 "$@" | wc -l ; fi; }<p>So, "lc /dir" will count the number of files in /dir and "lc /dir/*" will count the files in subdirectories of /dir. This is useful if you're working in an environment where you may have thousands of files in a directory, and a regular "ls -l" will lock your terminal while it eats your entire scrollback buffer.
grep -r . "some random debug message"
(searches for the passage recursively in all files from the directory it was executed, the main reason I like developing in linux more than windows)
Alt Sys Rq o - useful if you need to shut down a system and your kvm is not working.<p><a href="http://en.wikipedia.org/wiki/Magic_SysRq_key" rel="nofollow">http://en.wikipedia.org/wiki/Magic_SysRq_key</a>
I'm a fan of using cut or sed or awk and ending it with:<p><pre><code> | sort | uniq -c | sort -n -r | head
</code></pre>
to get a nice top 10 whatevers in the whoosit
On zsh, "print -rC2" for printing some listing in 2 column format. The number of columns (C) can be specified. (print is a builtin).<p>zsh's file globbing is awesome. Some simple ones:<p><pre><code> *(.) - only files
*(/) - only dirs
*(.m0) - files modified today
*(.om[1,15]) - 15 recently modified files</code></pre>
faucet 80 --in cat<p>This is useful for creating a connection for receiving the input of what you get...<p>e.g. running<p>faucet 80 --in cat<p>and later<p>curl <a href="http://127.0.0.1:80" rel="nofollow">http://127.0.0.1:80</a><p>will deliver to you console :<p>GET / HTTP/1.1
User-Agent: curl/7.21.4 (i686-pc-linux-gnu) libcurl/7.21.4 OpenSSL/0.9.8n zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:900
Accept: <i>/</i>
One of my favorite aliases that wasn't listed.<p>alias easy_search="curl -s <a href="http://pypi.python.org/simple/" rel="nofollow">http://pypi.python.org/simple/</a> | perl -ne 'print if s/<[^>]+>//g && $.>1'|grep"
I like the wikipedia DNS text lookup - I work in a "firewalled" environment where the unices are only allowed DNS queries. If only wikipedia could provide central switchboard numbers in their text fields as well ...
Single user mode on an HPUX machine was, I think, the most useful to me.<p>(<a href="http://www.unixhub.com/docs/hpux/hpux_boot.html" rel="nofollow">http://www.unixhub.com/docs/hpux/hpux_boot.html</a>)<p>I wish I still had that machine, but I do not.
Here's my list, a very compact plaintext file: <a href="http://mmb.pcb.ub.es/~carlesfe/unix/tricks.txt" rel="nofollow">http://mmb.pcb.ub.es/~carlesfe/unix/tricks.txt</a>
Not really a unix command, but a vi command that has been really useful, specially if you do lots of editing protected files and want to keep your custom vim configuration:<p>!sudo tee %
I find this site handy for clever commands:
<a href="http://www.commandlinefu.com/commands/browse" rel="nofollow">http://www.commandlinefu.com/commands/browse</a>
that's the original<p><a href="http://www.commandlinefu.com/commands/browse/sort-by-votes" rel="nofollow">http://www.commandlinefu.com/commands/browse/sort-by-votes</a>
esc-#, comments the current line<p>ctrl-\, kills current process even xtail<p>xtail, tails dirs<p>tweaks in .inputrc to have up and down arrow do backward history search, like in ipython.