More useful UNIX commands.

Posted: December 27, 2011. At: 9:44 PM. This was 6 years ago. Post ID: 2327

Time a UNIX command. the time(1) command will tell you how long it took for a command to execute.

[email protected] cgi $ time ls
total 28K
drwxrwxr-x. 3 thx thx 4.0K  26-12-11 09:43 pm .
drwxrwxr-x. 6 thx thx 4.0K  26-12-11 09:41 pm ..
-rw-r--r--. 1 thx thx 1.5K  23-12-11 10:58 am fortunes2
drwxr-xr-x. 2 thx thx 4.0K  25-12-11 05:39 pm html
-rwxr-xr-x. 1 thx thx  471  23-12-11 10:58 am index.cgi
-rwxr-xr-x. 1 thx thx 5.8K  23-12-11 10:58 am viewblog.cgi

real	0m0.020s
user	0m0.000s
sys	0m0.005s
[email protected] cgi $

Listing all logged in users on your UNIX/Linux system. This command uses the finger(1) command to list all users and print the information in a user friendly manner.

[email protected] ~ $ finger -lmps $LOGNAME | sed -e "s/On/Logged in/g" | grep "since"
Logged in since Tue Dec 27 15:00 (EST) on tty7 from :0
Logged in since Tue Dec 27 20:38 (EST) on pts/1 from :0.0
[email protected] ~ $

Tree view for the ps command.

[email protected] ~ $ pstree -a -u -G -l -h -p

Human readable directory size display. This is a very useful command indeed for finding just how much space a certain folder is taking up on your hard drive.

[email protected] Desktop $ du -ack -BM | sort -nr | head -n 20
3071M	total
3071M	.
2957M	./Moar
2071M	./Moar/FreeBSD-8.1-RELEASE-i386-dvd1.iso
813M	./Moar/Photos
712M	./Moar/Photos/V-The.Empire.Strikes.Back[1980]DvDrip-aXXo.avi
56M	./AfterStep-2.2.11
27M	./Moar/Images
27M	./AfterStep-2.2.11/src
19M	./Moar/mini.iso
15M	./Soeren.aac
15M	./Moar/Photos/alien-landscape.xcf.gz
13M	./Scanned Document.xcf.gz
12M	./Scanned Document.png
12M	./AfterStep-2.2.11/libAfterImage
10M	./Moar/Photos/
9M	./Moar/Photos/pipes.xcf.gz
9M	./Moar/Photos/linux the complete reference.pdf
9M	./AfterStep-2.2.11/afterstep
8M	./Moar/Images/eye.xcf.gz
[email protected] Desktop $

Using YUM to check what updates are available for your Fedora Core 15 system.

[[email protected] Desktop]# yum check-update

This command will install all pending updates to your Fedora Core 15 system.

[[email protected] Desktop]# yum check-update
1 responses to “More useful UNIX commands.

Leave a Reply