Here’s a fun Friday post…
Some of you may know I’ve been preparing to brush up on my *nix skills. A couple of our new solutions are running on Linux platforms and I feel compelled to understand any platform I’m working with inside and out… I know, it’s a bit OCD.
But to be honest, I haven’t really touched a Linux platform for about 10 years, since I was one of the three students running the Sun network over at NCSSM. I still remember the humorous ‘root’ ‘of all evil’ admin name that we used and the password, iaceo (in mixed caps), which was a Latin word for (I think) to lie dead. (Please correct me if you know what it means). When you’re 17, these things are amusing.
I’ve kept my ls-ing and cd-ing over the years, but will be brushing up on the grep-ing and tail-ing ;)
So with any system, I think we all have our favourite commands that we use daily and are part of our daily arsenal. I’m working out mine but wanted to hear from you…
What are your 3 favorite Linux commands?
And is there 1 obscure one you really love (or hate)?
# # #
Awk
sed
Vim
Obscure command = fg
ne
screen
pstree -n
;)
dd
lsof
grep
and obscure is hexdump
That would be “exit” command :)
The aprapos sounds interesting too… have to check that one out.
“
Leigh,
That’s exactly the cmd I was thinking of- thanks!
-jj
”
I looked over the commands everyone submitted. Its a great list but the one I use often that isn’t listed is apropos. Its a great for searching for commands when you don’t know their exact names.
“
JJ: that undex-using command would be locate. It uses a database which is set on many distros to update daily at 3am, so if you’ve made more recent changes and want to re-index, you’ll want to run a sudo updatedb first :)
”
“
These are all great!
Someone was telling me about an index-type command to allow you to search all files, regardless of the dir they were in…
Any ideas what that was?
-jj
”
“
lsof – useful for finding any open files (even IP sockets!) and tracking down problems.
awk – In the right hands, it’s very powerful. can sort, parse, format and search. Things you’d pipe through multiple cut/grep/sort pipe mazes you can often nail down with one line of awk.
find – learn ALL the command-line switches and how they differ between Linux, Solaris, AIX and BSD.
There are too many "obscure" commands and packages to even list. Knowing how to efficiently use the mundane together is more important, IMHO.
”
that last comment was also supposed to have
"insert your favourite scripting language here"
“
OH AND… GNU ddrescue ( http://www.gnu.org/software/ddrescue/ddrescue.html ) for being the best damn hard disk recovery tool money can’t buy. I’ve saved countless (ok, like 3) nearly-dead drives from an expensive trip to the clean room with this command.
”
“
I can’t sing the praises of screen enough. Until the server was physically moved from the US to Canada, I had one screen session with an uptime of nearly a year.
Other favourites are wget with the UA set to Interweb Exploder for malware acquisition without trashing my reversing environment, and mutt for old-skewl email :)
”
How could I forget Vi! I’m totally adding a fourth.
4) Vi
find
grep
“
top
vi
grep
obscure one: set -o vi (lets use use vi at the command prompt to go back, forward, and edit like you’re in vi)
”
“
tcpdump
scp
ssh
Not that obscure, but not as known as it should be, iftop. I would be lost without it.
”
“
Karsten,
lmao..
Okay kids- do NOT try Karsten’s fav (unless you want to delete everything) ;)
-jj
”
less: is more (and lets you browse before vi)
script: cuz sometimes you need evidence (and an electronic memory)
dd: because sometimes you need to capture the whole damn thing just the way it is.
“
1)vim. Can’t live without it.
2)ruby/irb. For when bash scripting just won’t do.
3)hg. For change management, and rolling back from the "oh crap" moments.
Obscure commands? xargs is the shell scripting swiss army knife, but it’s not really obscure. Then again when you talk to Unix weenies, nothing is really obscure. ;-)
”
“
Well, the one and only most important command is of course the
"read mail really fast": rm -rf
(no, don’t try this at home … ;-) )
”
“
1) I have to go with the "screen" command too, very useful.
2) grep
3) curl. I’m such a curl fan, I use it on windows too.
Don’t really know what I’d count as obscure. Maybe all the crazy sed and awk stuff that you can do?
”
1. top
2. mii-tool
3. man :-)
“
1) tcpdump I mostly use Linux boxes for servers and I am constantly troubleshooting stuff. tcpdump is your friend.
2) screen You can have multiple terminals open from a single console, SSH, or telnet session. best part, if you close the connection or get dropped, you can just get back to the box, type screen -dr to have all of your windows and programs just the way you left them. Great for tailing a log file or running tcpdump searching for rare events.
3) lsof Learn this to investigate the dusty corners of your system. Open files, open sockets, what opened sockets, etc.
Obscure: 2&>1 is not a command, but dumps stderr to sdtout. Some *nix proggies dump useful information to sdterr.
”
“
My three favorite Linux commands:
1. nc – Netcat rocks.
2. perl – The ultimate programming language IMO. Fast, effective and powerful. And all from the command line.
3. clear – I really hate screens full of junk. :)
Obscure command I love? Well, I love strings but I’m not sure how obscure that is.
”