Commands you might have missed
Posted by Steve on Tue 15 Jul 2008 at 11:25
There are a lot of articles upon this site, and it appears that many of the most popular are those that are written with the complete beginner in mind. After realizing this I've got a decided to introduce a miniseries covering a few easily-overlooked tools and commands over the next week.
There are many scripts, tools, and commands available upon the average Debian GNU/Linux system. To the extent that I'm often amused that I've made a typo and accidentally invoked a valid command!
(xlogo was a command I only discovered by accident, for example. As was sl.)
For the next seven days I'll be introducing some of the commands which I use frequently, and may well be new to you.
If you have any suggested tools, or useful Debian packages that you'd like to recommend then please feel free to create your own article, or mention them in a comment.
wery useful, epecialy when newbee asking you for help )
[ Parent | Reply to this comment ]
Cheers
[ Parent | Reply to this comment ]
useful for scripting:
join
paste
rev, tac
useful for administration:
newgrp, sg
pwdx
namei
programming (maybe):
nl
[ Parent | Reply to this comment ]
The "yes" utility seems to be around in Unix systems forever.
-MB-
[ Parent | Reply to this comment ]
sustdevl1][~]
for n in `seq 1 3`; do uptime;done
10:53:54 up 492 days, 19:16, 2 users, load average: 0.00, 0.00, 0.00
10:53:54 up 492 days, 19:16, 2 users, load average: 0.00, 0.00, 0.00
10:53:54 up 492 days, 19:16, 2 users, load average: 0.00, 0.00, 0.00
[ Parent | Reply to this comment ]
uptime
uptime
uptime << 18 characters
The latter option is even less if you consider pressing <UP> and <ENTER> to be pretty easy, as most people probably do ;)
uptime
<UP> <ENTER>
<UP> <ENTER> << 10 characters
Moral of the story: sometimes you *really* don't need to use a for loop ;) Rather like pointless uses of cat, a la -- `cat file | grep <pattern>`.
[ Parent | Reply to this comment ]
for i in `seq 1 4`; scp file server0$i.domain.com:/home/user/; done
That will scp a file to servers01-04 without having to go back and edit the command 4 times.
[ Parent | Reply to this comment ]
find . -type f -not -name "*.log" -exec grep "text_to_search" '{}'\; -print
[ Parent | Reply to this comment ]
find . -type f ! -name "*.log" | xargs grep "text_to_search"
would be more native and more flexible imho (xargs has quite few params to satisfy needed party)
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
find . -type f ! -name "*.log" -print0 | xargs -0 grep "text_to_search"
Also little known is the ability of grep to automaticaly color matched patterns when supported by output (ie. grep will disable this automaticaly if piped on an other command, redirected to a file, etc). And as said above, "-H" is useful for such use case.
So we have now, with "robust paradigm" and more eye-candy :
find . -type f ! -name "*.log" -print0 | xargs -0 grep -H --color=tty "text_to_search"
[ Parent | Reply to this comment ]
GREP_OPTIONS="--color=auto"
in my environment ;-)
[ Parent | Reply to this comment ]
- jnettop
- vidir
- discus
- screen
And for having lessons and lectures:
- sm
- figlet
[ Parent | Reply to this comment ]