PDA

View Full Version : Favorite Unusual Command



wormser
March 11th, 2008, 10:08 PM
Do you have a command that is unusual that most users are unaware of or one that is used in an unusual way. Post any strange tips and tricks. Maybe it is a couple of commands put together. Just anything that is cool that others might find handy, I will start.


chattr -i file

Chattr with the -i switch sets an immutable bit. These are attributes to be added to the existing attributes of the files. A file with the ‘i’ attribute cannot be modified, it cannot be deleted or renamed,


lsattr file

Lsattr displays the chattr permissions.

Post'em.

blithen
March 11th, 2008, 11:03 PM
free -m
It shows the ram usage.

Hallvor
March 11th, 2008, 11:08 PM
[hallvor@localhost ~]$ df
Filesystem Size Used Avail Use% Mounted on
/dev/hdb1 11G 3,8G 6,1G 39% /
/dev/hdb3 101G 72G 25G 75% /mnt/hdb3
/dev/sda1 230G 92G 127G 43% /mnt/sda1
[hallvor@localhost ~]$

odiseo77
March 12th, 2008, 12:31 AM
I don't think these are unusual or something, but are interesting (at least to me):


history
history | grep -i <some piece of some command you forgot>

As many of you surely know, the history command displays the last nn commands used. If you remember a part of a command you want to use now, but you don't remember the whole command with its arguments, etc., you can type the last command I typed before and it will give you the command.

Also:


!command_name

Will execute the last command_name used with all it's arguments (useful when you want to use a command used before, which has a long piece of arguments, pipes, etc. Also usefull for repetitive tasks).


tail -f some_file

The tail command shows the last 10 lines of a file (although I think you can tell it to show more (or less) lines). The -f option leaves the file opened as it grows (useful to monitor log files quickly as they grow).

And so on. I'm sure there are lots of useful and unusual commands few people know about :)

p_quarles
March 12th, 2008, 12:38 AM
Useful:

du /path/to/dir
Summarizes the total disk space usage of the target directory.

Unusual:

kdontchangethehostname
Informs KDE about hostname changes.

InfinityCircuit
March 12th, 2008, 01:09 AM
I don't know how unusual this is, but I certainly use variations on it a lot. Let's say i'm running sidux and I want to remove all metapackages associated with the name "sidux-686"


dpkg -l | egrep *sidux-686 | cut -c 8- | cut -c -43 | xargs sudo dpkg -P

I'm old-fashioned.

herbster
March 12th, 2008, 07:24 AM
Dunno if unusual, but sometimes if I know the full objective I'll just put everything on one line:


cd Desktop && tar cjf stuff.tar files && mv stuff.tar /media/backup && cd /media/backup && rsync -avz stuff.tar host@sshserver:backup/

Hitting the "&&" feels almost like a beat, keepin' that CLI rhythm goin' :D

Erik Trybom
March 12th, 2008, 09:17 AM
ls -d */

It displays the directories contained in the current directory. Not that obvious and very useful.

spupy
March 12th, 2008, 12:26 PM
It's not installed by default, but

sl
Try it also with these args: -a -l
:twisted:

NightwishFan
March 12th, 2008, 12:29 PM
I am famous for mentioning this one. :)

espeak "what you wanna say"

fuscia
March 12th, 2008, 02:01 PM
+1 to espeak "somethingobsceneandgenerallysophomoric"

spupy
March 12th, 2008, 10:36 PM
I am famous for mentioning this one. :)

espeak "what you wanna say"

Thank you! Ahahahaha


espeak "All your base are belong to us"

der_joachim
March 13th, 2008, 07:00 PM
oachim@remade:~$ cowsay "`fortune`"
___________________________________
/ Life is to you a dashing and bold \
\ adventure. /
-----------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||

:)

spupy
March 13th, 2008, 09:34 PM
Thanks to you guys, this is my latest greatest invention. I bring you...

RoboCow.sh:

#!/bin/bash
fort=`fortune -a`
cowsay $fort
espeak "$fort"

GNUlancer
March 13th, 2008, 10:35 PM
man, info.
Most users seem to be not aware of these :D