Operating System - HP-UX
1825771 Members
2160 Online
109687 Solutions
New Discussion

The 3 most ingenious UNIX line commands are ...?

 
HP Education_2
Occasional Contributor

The 3 most ingenious UNIX line commands are ...?

These days, everybody talks menu options. But UNIX has line commands, with its
own ingenious options. Let's hear about your favorites.
27 REPLIES 27
Dan Henderson_4
New Member

Re: The 3 most ingenious UNIX line commands are ...?

This is my favorite!

echo Mhbqnrnes Stbjr | tr [a-y] [b-z]
Kirk Gardner_1
New Member

Re: The 3 most ingenious UNIX line commands are ...?

Here's mine:

[ `basename $SHELL` = "ksh" ] && PS1=`uname -n`:`id -un`:'$PWD'"> " ; export
PS1
Sanjay D_1
New Member

Re: The 3 most ingenious UNIX line commands are ...?

My list

1. fsck
2. find
3. grep

Sanjay d
karategal24
New Member

Re: The 3 most ingenious UNIX line commands are ...?

make war

make sense

lost

echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287
578439snlbxq'|dc

:-)
brain_2
New Member

Re: The 3 most ingenious UNIX line commands are ...?

excellent!
Narender Reddy
New Member

Re: The 3 most ingenious UNIX line commands are ...?

1)bdf
2)dmesg
3)swapinfo
Joe Black_4
New Member

Re: The 3 most ingenious UNIX line commands are ...?

1. xargs
2. find
3. man :)
Bhuwan Pandey
New Member

Re: The 3 most ingenious UNIX line commands are ...?

top, ps -ef|more, bdf
a unix person
New Member

Re: The 3 most ingenious UNIX line commands are ...?

I like this one for searching for strings in files

e.g. you are not sure which startup files contain the word
network

find /dirname -type f -exec grep -il network {} \;


simple but very useful
Stu_17
New Member

Re: The 3 most ingenious UNIX line commands are ...?

smit

...oh, sorry!
Larry Sybrandt_1
New Member

Re: The 3 most ingenious UNIX line commands are ...?

1) shutdown -h
2) reboot -h
3) halt
Scott Riley_4
New Member

Re: The 3 most ingenious UNIX line commands are ...?

for
do
done

Which is something that simply cannot be duplicated in a GUI interface.
Tim_374
New Member

Re: The 3 most ingenious UNIX line commands are ...?

Ingenious? My Webster's dictionary says Ingenious means cleverly inventive.
So, what are the 3 most cleverly inventive UNIX line commands? As originally
designed, they may possibly be:

1. the pipe command "|"- it allows the construction of elegant and ingenious
command line strings from a series of simple Unix commands.

2. the IO redirection command "<>"- it allows input/output to be easily
redirected to other files or devices.

3. the concept that EVERYTHING is a file. (I could be wrong about this but I
can't think of a third command).

Any better suggestions?
Vasudev Ram
New Member

Re: The 3 most ingenious UNIX line commands are ...?

` (backquote)

eval args

cmd &

javier juarez_1
Occasional Advisor

Re: The 3 most ingenious UNIX line commands are ...?

echo $?
man
whoami

in that order, if the first result is non zero
Ray. Van ommen
New Member

Re: The 3 most ingenious UNIX line commands are ...?

1. Win
2. dows/
3. NT

.... OEPS... :)

Sorry, mistake...

1. |
2. awk
3. sed
Steven Sim Kok Leong
Honored Contributor

Re: The 3 most ingenious UNIX line commands are ...?

Bringing it back to top! :P
Roger Baptiste
Honored Contributor

Re: The 3 most ingenious UNIX line commands are ...?


kill

mount

find

-raj
Take it easy.
Steven Sim Kok Leong
Honored Contributor

Re: The 3 most ingenious UNIX line commands are ...?

For me,

1) find
2) sed
3) awk

Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Bill Hassell
Honored Contributor

Re: The 3 most ingenious UNIX line commands are ...?

(how to start an editor war)

My favorite is vi

and my 2 favorite vi .exrc features use the little known commands: adjust and spell

map #3 !}exec adjust -m72^M
map S G:w!^M:r!spell %^M

The first is a shorthand for trapping function keys, in this case f3. So when I put the cursor somewhere on the first line of a paragraph and press f3, the paragraph is reformatted to fit into 72 columns. (I have other keys for 60 columns and 80 columns). The adjust command is a powerful tool for formatting text files. You can simulate the HP function keys by typing the 2-letter sequence: f1 = ESC p f2 = ESC q and f3 = ESC r and so on.

The second comes right out of the "Ultimate Guide to VI" book (from HP) and will spellcheck your file, appending all the unknown words at the bottom of your file. Since there is no S command in vi, I defined it as the spell checker.

Another favorite is option is ai (as in :set ai) which eliminates having to space over when writing code so that sections are indented and aligned automatically.

The incantation: UNIX95= ps
is a favorite. There are a LOT of options most people don't know about in the ps man page, and some of the best require the UNIX95= setting. Ever seen this:

# ps -ef | grep -v grep | grep myprogram

Most of us learned this in Unix 101. It searches every line in ps -ef for the string myprogram and the grep -v grep gets rid of the grep that you are running. What if you need to search for grep?

So here's a great one to replace it:

# UNIX95= ps -f -C myprogram

See? No grep required! And what if you are looking for a program called root--grep doesn't care where the string is located. Here is another example:

# UNIX95= ps -f -C sh

Need to see all thre related parent/child relationships:

# UNIX95= ps -efH | more

And the favorite for solving memory problems:

# UNIX95= ps -e -o vsz,ruser,pid,args | sort -rn | more


Bill Hassell, sysadmin
George_Dodds
Honored Contributor

Re: The 3 most ingenious UNIX line commands are ...?

ps -ef|grep
Mark Greene_1
Honored Contributor

Re: The 3 most ingenious UNIX line commands are ...?

fortune

This ought to be, at the least, an unsupported command, perhaps an easter-egg type of surprise. A patch to add it back would be nice (hint, hint). :-)

--
mark
the future will be a lot like now, only later
harry d brown jr
Honored Contributor

Re: The 3 most ingenious UNIX line commands are ...?


The best? Well it would have to be:

cat /dev/null > ./windows/any/os

My list, although not limited to 3, is:
dd
od or xd
sed
|
tee
regular and extended expressions
grep
xargs
redirection <, >, >>
rcp, rsh, ...
ls
ps
kill
tr and y


live free or die
harry
Live Free or Die
Krishna Prasad
Trusted Contributor

Re: The 3 most ingenious UNIX line commands are ...?

ps -fu
finger
fsck
Positive Results requires Positive Thinking