Live data from Hacker News

What's the one Linux command you wish you knew years ago?

reddit.com

131–140 of 216 posts

Re: What's the one Linux command you wish you knew years ago?

#131
post #76
post #52

Earlier quoted context omitted.

Many comments seem to be shell- and bash-related. Perhaps the thread exposes how difficult to read the bash manpage is. On my system, the bash 4.1 manpage is 41026 words long, or about 80 pages. Manpages are most useful to me when they are short and to-the-point so I can find what I am looking for before I lose interest in skimming through an 80 page book.

I'm baffled all the time by the lack of clear examples on many manpages.

Same here, most man pages seem pretty good at documenting all the available options, but are pretty useless at explaining how the tool should actually be used.

I'd like to see someone dump all the common man pages into a public wiki so people could flesh out the usage examples and suggest alternative tools.

Re: What's the one Linux command you wish you knew years ago?

#132
post #24

That reddit thread is delightful, because it is full of wonderful commands that I didn't know, or rarely use, or had forgotten. But it's also terrifying, because it exposes how many people will post questions before using man.

I personally find man and info very cumbersome and hard to read. I usually google for things even when I know full well that its covered by man and where, because the google results are normally a lot easier for me to read and figure out than it is for me to read the manpages.

Re: What's the one Linux command you wish you knew years ago?

#134

Actually the new top comment blew me away. I'm in the 20 year veteran category and was also oblivious. Quoted: disown - bash built in. You know how you always start that mega long rsync in an ssh session from your laptop and then realize you have to go offline halfway through? You forgot to start it in screen or nohup, didn't you? You can pause it (ctrl+z), background it (bg), and then disown it so it is protected fr…

'man bash' is pretty amazing the first time you actually read through it.

And when you're done with that, try 'man zsh'.

Re: What's the one Linux command you wish you knew years ago?

#135
post #130
post #45

Earlier quoted context omitted.

disown is great. However, I don't know if it's possible to start up a new shell, then bring back that process to the foreground. 'jobs' will return no entries, and fg doesn't take a PID parameter. Any ideas? It would be brilliant if that were possible with bash alone.

Screen is the only real answer, I've ever found.

There's also 'tmux':

http://tmux.sourceforge.net/

Re: What's the one Linux command you wish you knew years ago?

#136
post #80
post #70

Earlier quoted context omitted.

By reducing the needless complexity that it implements. The purpose of a Unix shell is to interpret a simple language wrapping syscalls so the user can easily give instructions to the kernel. There are several such shells whose source code is smaller than the bash manpage. 13 pages of the 80 page manual are devoted to readline and programmable completion. Readline and programmable completion could be removed from the…

$ man bash | wc -l 5351 $ 9 man rc | wc -l 496 You may want to check out the `rc' shell from Plan 9 (carried over from latest UNICes). Simple, elegant. Available for linux via http://swtch.com/plan9port/ Manpage at http://swtch.com/plan9port/man/man1/rc.html

i believe the p9 in his name is short for "plan 9" :)

Re: What's the one Linux command you wish you knew years ago?

#137
post #104
post #3

100% agree with CTRL-R. It changed my life. Others that I love: screen, pdsh, perl -pi -e 's/find/replace/g' *.txt redis-cli's new ability to have piped in data be the last argument of a command. vim -o file1.txt file2.txt file3.txt (opening multiple files with vim) Using vim instead of less as a pager: cat file.txt | vim -

> screen Unless you only use GPL software, there's no reason to not use tmux these days. Well, maybe if you're on HP-UX or something. http://tmux.sourceforge.net/

I've switched from screen to tmux about a year or two ago, after decades of using screen.. and I'm perfectly happy with tmux, as it fits my needs.

However, it's not true that screen has no advantages over tmux. Each program has its own strengths and weaknesses. For instance, screen is scriptable via its Lua bindings, tmux is not. Screen has zmodem support built in, tmux does not. There are probably many other examples, since screen has a bazillion features which have been developed over decades, while tmux is relatively new (and its developers don't seem to care to duplicate every one of screen's features).

Re: What's the one Linux command you wish you knew years ago?

#139
post #24

That reddit thread is delightful, because it is full of wonderful commands that I didn't know, or rarely use, or had forgotten. But it's also terrifying, because it exposes how many people will post questions before using man.

I was taken aback by one commenter whose command he wished he'd known for years was man, newly discovered by him. "All those years of googling, wasted." What happened that it's possible for someone to not know that it exists?

Google is what happened. Not to date myself, but when I was first learning (BSDi) UNIX Google didn't exist. The first thing the sys-admin who helped me said was, "type 'man'."

These days most people just know that if they have an unanswered question, ask the Google.

Re: What's the one Linux command you wish you knew years ago?

#140
post #84

Earlier quoted context omitted.

While it doesn't fix the issue, zsh's man page is divided into different sections, which at least alleviates it.

And zsh has the user-friendly users guide: http://zsh.sourceforge.net/Guide/ This is how I learned unix shell back around 2000ish. Aside of giving an excellent insight into zsh, it also gives many good hints and notes about unix shells in general.

The first two or three chapters of that guide are pretty good, but then it gets bogged down in obscure minutia to such a degree that you start to feel almost like you're just reading the zsh man pages again.

The guide is in some serious need of a good editor to make it more concise and better organized. It also needs many more simple, practical examples. Unfortunately, it hasn't been updated since 2002, which also makes it a bit obsolete, since zsh development has been very active since then and zsh is now on to a new major version.

Overall, the guide is a nice try, but zsh needs more and better documentation if its not going to overwhelm all but the most dedicated users.

Post reply on HN