Welcome to WebmasterWorld Guest from 54.196.244.186

Forum Moderators: bakedjake

Message Too Old, No Replies

Favorite command line tools?

     
3:48 am on Aug 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member littleman is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:June 17, 2000
posts:2924
votes: 0


What are your top command line or term based tools and apps?
9:46 am on Aug 7, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 28, 2002
posts:492
votes: 0


Mostly the shell itself, with the ability to make complex commands with loops, tests and substitutions.

Mutt the mail reader.

grep for search in log files

tail for monitoring log files

12:54 pm on Aug 7, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 27, 2003
posts:166
votes: 0


grep, less, wget
3:48 pm on Aug 7, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 4, 2000
posts:446
votes: 0


shutdown?

shutdown -h now

3:57 pm on Aug 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 25, 2002
posts:677
votes: 0


grep, sed, tail
5:24 pm on Aug 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 14, 2002
posts:1192
votes: 0


  1. sed for surgery on multiple files
  2. awk to take a colon-separated list and make an HTML table
  3. perl for many other tasks, though I never developed the same familiarity with it as with the older tools
5:31 pm on Aug 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 4, 2002
posts:5044
votes: 0


  • Mutt
  • Lynx

I never got to grips with sed, what's it good for in everyday use?

Nick

5:31 pm on Aug 7, 2003 (gmt 0)

Administrator

WebmasterWorld Administrator bakedjake is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 8, 2003
posts:3783
votes: 2


ssh - for connecting to remote sites

ncftp2 - ncftp is the coolest ftp client on the planet (version 2)

du - for checking disk space of directories

netstat, tcpdump - for debugging network connections

5:42 pm on Aug 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 18, 2003
posts:827
votes: 0


You mean that there are non-command line tools?

ruby is my swiss-army knife, and is combined with just about the rest of /bin, /usr/bin, and /usr/local/bin. Every now and then I use something in /sbin, /usr/sbin, /usr/local/sbin, and /usr/X11R6/bin.

Oh, and lets not forget the tools in ~/bin, and ~/.aliases :)

6:41 am on Aug 8, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 27, 2001
posts:784
votes: 0


ssh, rsync - for connecting to remote machines and maintaining mirrors (I use rsync for my web sites).

mutt, procmail, spamassassin - for email

vi - editing files

perl - one-liners for munging files

python - for longer scripts

6:51 am on Aug 8, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 4, 2002
posts:5044
votes: 0


Which reminds me

Vim!
ncftp
ssh

Nick

8:08 am on Aug 8, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 28, 2002
posts:492
votes: 0


All this discussion got me curious, so a ran this on my desktop machine

history ¦ awk '{print $2}' ¦ sort ¦ uniq -c ¦ sort -n

and god this:

484 ls
400 cd
394 perl
288 man
233 less
186 apt-cache
170 mysql
123 locate
119 make
104 dpkg
95 rm
87 grep
71 ps
64 tail
63 jed
63 cvs
57 bc
56 sh
56 mv
45 cat
42 wget
38 host
35 eog
34 xlsatoms
34 mysqldump
34 gcc
33 cp
31 rsync
31 cvs
30 ssh
30 find

As you can see, I do most of my file management in the shell. I never quite got used to graphical file managers, even though I use nautilus regularly.

Besides file management, there's some development work (perl, cvs, man, gcc, make), some server updates (rsync, ssh) and some maintenance (apt-cache, dpkg, mysqldump)

BTW, I keep a history of 5000 commands, hence the high numbers.

1:01 pm on Aug 8, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 26, 2000
posts:414
votes: 0



rpm
up2date
iptables
apt*
7:47 pm on Aug 8, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:June 16, 2003
posts:633
votes: 0


killall -9
8:10 pm on Aug 8, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 25, 2002
posts:677
votes: 0


I never got to grips with sed, what's it good for in everyday use?

I use it mostly for transforming text files. For example, one script processes an error log from a major database application. Once grep is done, sed processes the results, turning them into a nice simple html page with the errors in an ordered list.

(sed basically allows you to take "vi" commands, write 'em out in a text file, and use that file to transform whatever file(s) you want.)

8:17 pm on Aug 8, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 18, 2003
posts:1925
votes: 0


vi
grep
tail
perl
8:24 pm on Aug 8, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 12, 2002
posts:885
votes: 0


rig (Random Identity Generator)
find
file
lsof
emacs
tail
nohup
ssh
ps
less
links
8:27 pm on Aug 8, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member eliteweb is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:June 5, 2001
posts:2723
votes: 0


nmap
crack
john
tcpdump
lsof

mMmmMmm course those are a mix of binaries and such but still my favorite ;)

8:29 pm on Aug 8, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 2, 2002
posts:1167
votes: 0


For the uneducated amongst us, which may be just me, what is the wget command used for?

I've seen wget sumthinornuther in my logs but dinna really know what it was.

8:39 pm on Aug 8, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member eliteweb is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:June 5, 2001
posts:2723
votes: 0


man wget ;)

GNU Wget is a freely available network utility to retrieve
files from the World Wide Web, using HTTP (Hyper Text
Transfer Protocol) and FTP (File Transfer Protocol), the
two most widely used Internet protocols. It has many use-
ful features to make downloading easier, some of them
being...
10:36 pm on Aug 8, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:June 16, 2003
posts:633
votes: 0


Did I mention that command line PHP owns? :)

-panic

11:49 am on Aug 9, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Mar 14, 2002
posts:325
votes: 0


sed basically allows you to take "vi" commands

Actually it's the inverse. In the old times the only way to edit a text file was with ed (not sed), until Billy Joy got sick of dealing with unbuffered lines and devised a VIsual ed :)

Oh, and...

ogg123
dselect
ssh, ssh-add, cvs
make install
locate
My countless bash scripts based on wget

<added>I stand corrected.</added>

Some more:

octave, maxima
python as a calculator
cal, calendar, date
fortune

[edited by: Duckula at 1:20 pm (utc) on Aug. 9, 2003]

12:18 pm on Aug 9, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 28, 2002
posts:492
votes: 0


Well, first there was ed, short for editor, with a user interface specially developed for paper terminals. It is still unbeaten in that sector :-)

When the first common teletypes (monochrome text-only monitors common in the 70s and early 80s) appeared, you could programmatically control a viewing area of more than one line, so ex/vi appeared. Ex was little more than a beefed up ed, and vi was the corresponding visual superstructure, the display engine, if you want. You could still run ex in commandline mode, just as ed, if you had to, but running vi on a paper terminal used up a lot of paper :-)

Sed was a variation of ed, and thus independent of ex/vi. Ed was actually rather powerful, especially wrt to search and replace functions, so when the pipe was invented back in the 70s (must have been Unix v4 or v5, because it was definitely there in v6), the ed internals was modified to work as a filter, hence sed, Stream EDitor. Given it was invented for use in pipes, in wonder why they didn't opt for ped, Pipe EDitor, but they didn't.

Grep is also a child of ed. The command in ed for finding and printing lines that match a regular expression is (literally) "g/RE/p" where RE is the Regular Expresssion. Grep is just that part separated from the ed interface. Later the extended grep (egrep) and the fixed string (fgrep) joined the family. Grep was also a part of Unix v6, so it is also from one of the very early version of Unix.

René

12:22 pm on Aug 9, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 26, 2003
posts:881
votes: 0


df (list all mounted file devices w/ stats)
netstat -a (list all active sockets w/ packet info)
killall -KILL bin (kill the process bin and all its child processes (nb. quick and dirty and may leave zombies in some cases -- -TERM or -HUP is sometimes a better signal choice))
locate string1 [, string2] (search filesystem index for all instances of string string1, ...2, ...3, &c.)
command > something.txt (pipe output of command into file something.txt, creates file first if not exists)

Jordan

8:06 pm on Aug 9, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 15, 2002
posts:710
votes: 0


whoami (but it never quite gives me the answer I'm looking for :p)

But seriously, in addition to that and others mentioned already:

tail -f <-- great for watching log files in real time
vmstat
top
df
tar
scp
sftp
The whole FreeBSD Ports system!

5:54 am on Aug 13, 2003 (gmt 0)

New User

10+ Year Member

joined:Aug 13, 2003
posts:4
votes: 0



r.m -rf /*

reboot

[edited by: littleman at 6:29 pm (utc) on Aug. 13, 2003]
[edit reason] put the dot into save somebody a world of hurt [/edit]

5:55 am on Aug 13, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 11, 2003
posts:442
votes: 0


grep, awk, sort, uniq, tail
3:15 pm on Aug 13, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 15, 2002
posts:710
votes: 0


rm -rf /*

^--- that deletes all the files on your hard disk.

I'm sure that was meant as a joke but I'd hate to see anyone who didn't know better give it a try. Always read the man pages, in this case:

man rm
3:32 pm on Aug 13, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 12, 2002
posts:885
votes: 0


Reason number n++ not to run around as root all the time ;)

Of course, for most people all the important stuff is in their home directory and readable/writable by their normal user anyway.

6:28 pm on Aug 13, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member littleman is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:June 17, 2000
posts:2924
votes: 0


My connection was down all last night and I missed that one. Please do not post any damaging code.
This 34 message thread spans 2 pages: 34