
Sick Linux Commands - julian37
http://blog.urfix.com/25-sick-linux-commands/
======
samstokes
Here's one more people should know about:

 _11) Make ‘less’ behave like ‘tail -f’_

    
    
        less +F somelogfile
    

_Using +F will put less in follow mode. This works similar to ‘tail -f’. To
stop scrolling, use the interrupt_ [i.e. Ctrl-C]. _Then you’ll get the normal
benefits of less (scroll, etc.)._

 _Pressing SHIFT-F will resume the ‘tailling’_ [sic].

This is really useful for watching logs while debugging - if you see something
interesting scroll past, Ctrl-C to freeze it, then you can use ? with a regex
to search back for previous occurrences of the interesting thing.

To explain the cryptic +F syntax: anything you pass after the + is interpreted
by less as if you'd pressed those keys while less was running, and Shift-F
enables follow mode. So +F just puts less straight into tail mode.

Conversely, you can enable regular command-line options once a less session is
already running, by just typing them. For example, I usually run 'less -i' for
case-insensitive search, but if I forget the -i, I can just type -i once less
has started to disable case sensitivity.

less is actually much more powerful than its standard use as a mere pager
would suggest.

~~~
notyourwork
Can I ask why not to just use tail? What benefit does this serve?

~~~
jfb
Can modern tails stop following and search back up the buffer? That's why I
use less +F, personally.

------
jcw
Why is it that these are a mystery to most command-line users? Any linux
documentation that would be useful to intermediate users, like this article,
is scattered across the internet. Even published books don't seem to cut it,
and man pages are often too terse and dense to be readable. Is there a
thorough, concise linux documentation that I don't know about?

~~~
silentbicycle
While it's somewhat old, _The Unix Programming Environment_ covers _the
mindset_ and a lot of the fundamental tools. _Unix Power Tools_ is another
good one. This stuff is particularly novel to people who learned Unix from
e.g. Ubuntu + GNOME and worked towards the command line, rather than starting
there.

A lot of the tricks listed in the article should be in the man page for sh.
I've found a lot reading man pages, but I also use OpenBSD rather than Linux,
and its man pages are often noticeably better. (The "we only have a man page
to remind you that info is better" pages for GNU utils on Debian are among the
worst man pages.) Either way, "apropos" and man pages' SEE ALSO section should
help.

I've also found several cool utilities looking at summaries of what was
available in the OpenBSD & FreeBSD ports trees, especially in the sysutils and
devel categories.

Finally, people who are already using ratpoison/dwm/wmii. as their
windowmanager, mpd for playing music, etc. tend to have a common aesthetic,
and can usually recommend several other tools. Check out
<http://onethingwell.org> and <http://suckless.org> for starters.

------
jfb
I make this comment on every one of these posts, but the one I am _so glad_
some beardie committed way back in the dim mists of time is "tsort". Sure,
only the linker _really_ needs a topological sort, but pulling it out into a
separate executable has saved my bacon on more than one occasion.

It's little gems like that that make Unix bearable.

~~~
Monkeyget
In what kind of situations do you use topological sort? I can't think of any
scenario where I would use it leading me to think that there are problems I
could solve more easily by thinking of them as graph problems.

~~~
jfb
I've used it to drive a bunch of independent makefiles, when I didn't need an
overarching makefile. I've used it to sort dependencies in a simple work queue
thing I wrote in the shell. It's not generally all that useful, but being able
to grab it and do a quick tsort on paired strings is significantly less
painful than writing a Python or Scheme script to do it, and it fits neatly
into a pipeline.

------
dkarl
Minor gotcha: -- has been morphed to a dash, so be careful to distinguish
between one hyphen ('-') and two hyphens (a dash) when typing or copying the
command options.

I actually love this feature for most writing. I use -- a lot in emails and in
texts and wish it would be expanded to a dash. It's an error in this case,
though, especially since copying and pasting the dash gives you one hyphen
instead of two.

~~~
xtacy
If you're on a Mac, Option+<hyphen> gives you endash. Shift+Option+<hyphen>
gives you the longer emdash.

------
vog
I especially like the first command "Like top, but for files". Unfortunately,
you can't copy&paste this command into your favorite shell, because the
apostrophes (') have been replace with some unicode characters (‘ and ’) which
look nicer, but are of course unknown to the shell:

watch -d -n 2 ‘df; ls -FlAt;’

The correct command would have been:

watch -d -n 2 'df; ls -FlAt;'

This seems to be yet another annoying automatism of some blog software.

~~~
iopuy
It wordpress :-(

~~~
dmoney
This plugin is supposed to stop quote replacement:
[http://coffee2code.com/archives/2004/06/27/plugin-
wpuntextur...](http://coffee2code.com/archives/2004/06/27/plugin-
wpuntexturize/)

Haven't tried it myself.

------
planckscnst
A little better than last time... The author's previous post that is referred
to at the top of the post is a ripoff of the top list (at the time) on
commandlinefu.com with a very small link only titled "source" at the bottom.
He would have done much better to write a short snippet about the the site
with a real link and the actual name of the site somewhere in the post. At
least this time, it seems not to be a direct copy of some list, and he links
to to the site at the top of the post.

------
_grrr
Yet more nifty commands <http://www.pixelbeat.org/cmdline.html>

------
Seth_Kriticos
Site is down for me. Here is a text-only Google cache version:

[http://webcache.googleusercontent.com/search?q=cache:DVyf69P...](http://webcache.googleusercontent.com/search?q=cache:DVyf69PMz1kJ:blog.urfix.com/25-sick-
linux-commands/+http://blog.urfix.com/25-sick-linux-commands/&hl=en&strip=1)

------
nitrogen
_21) Display which distro is installed

cat /etc/issue_

A better method is using the lsb_release tool:

    
    
      lsb_release -a
    

If that's not installed:

    
    
      cat /etc/lsb-release
    

may work.

------
uast23
Link seems to be broken !!

~~~
vog
The link isn't broken, but the site responding very slowly (took several
minutes for me).

It's yet another blog that fails to do the most basic thing in the web:
delivering small static content quickly.

~~~
Luyt
That's why I put a cache in front of my blog. The cache is only invalidated
when the content of the article changes, or a comment is added. Works really
great, page requests take about 10 msec cached, 200 msec uncached (on a shared
hosting platform).

------
khafra
#3 here is something I use; but I still haven't figured out any way to make it
sort correctly when using -h (human readable) output. Any ideas?

------
gnosis
_4) A very simple and useful stopwatch_

Try utimer instead:

<http://utimer.codealpha.net/utimer/>

~~~
burgerbrain
Utimer isn't everywhere like time is, and is thus much less useful.

~~~
gnosis
It's on my desktop, so it's plenty useful enough for me. And installing it
elsewhere isn't exactly rocket science.

I do appreciate the convenience of programs which are installed on every
system by default, but that doesn't mean those programs are the only ones
which are useful or worth using.

~~~
burgerbrain
> _And installing it elsewhere isn't exactly rocket science._

You install random convenience utilities on all of your production servers?

I didn't think so.

------
gbrindisi
I am always amazed by the power of netcat.

------
supremedialect
wow my server is crap!!!!!! but yeah it's a Marvell SheevaPlug

~~~
supremedialect
and using wordpress with all those damn plugins isn't really helping either

------
supremedialect
Ok Comments on site are now back on

