More useful UNIX commands.

Posted: December 27, 2011. At: 9:44 PM. This was 6 years ago. Post ID: 2327
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

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

ubuntu ~ $ sudo time find / -name dpkg.log
/var/log/dpkg.log
0.82user 1.82system 0:34.04elapsed 7%CPU (0avgtext+0avgdata 2260maxresident)k
679328inputs+0outputs (2major+4374minor)pagefaults 0swaps

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.

ubuntu ~ $ finger -lmps $LOGNAME | sed -e "s/On/Logged in/g" | grep "since"
Logged in since Wed Dec 27 21:42 (UTC) on pts/0 from 192.168.100.1

Tree view for the ps command.

ubuntu ~ $ pstree -a -u -G -l -h -p | head -n 20
init,1
  ├─acpid,1272 -c /etc/acpi/events -s /var/run/acpid.socket
  ├─apache2,4233 -k start
  │   ├─apache2,26326,www-data -k start
  │   ├─apache2,26327,www-data -k start
  │   ├─apache2,26328,www-data -k start
  │   ├─apache2,26329,www-data -k start
  │   ├─apache2,26330,www-data -k start
  │   └─apache2,28733,www-data -k start
  ├─atd,1317,daemon
  ├─atop,7187 -a -w /var/log/atop/atop_20171227 600
  ├─cron,1316
  ├─dbus-daemon,947,messagebus --system --fork
  ├─dhclient,573 -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0
  ├─getty,1234 -8 38400 tty4
  ├─getty,1237 -8 38400 tty5
  ├─getty,1241 -8 38400 tty2
  ├─getty,1242 -8 38400 tty3
  ├─getty,1245 -8 38400 tty6
  ├─getty,1771 -8 38400 tty1

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.

ubuntu ~/Documents $ du -ack -BM | sort -nr | head -n 20
74M     total
74M     .
23M     ./wpscan
20M     ./system.save
19M     ./wpscan/.git/objects/pack/pack-9d321cf60e3e0fedc838fe768822143c3fd91cbe.pack
19M     ./wpscan/.git/objects/pack
19M     ./wpscan/.git/objects
19M     ./wpscan/.git
17M     ./impacket-read-only
10M     ./SYSTEM
7M      ./impacket-read-only/.svn/pristine
7M      ./impacket-read-only/.svn
5M      ./python/pycrypto-2.6
5M      ./python
5M      ./impacket-read-only/impacket
5M      ./impacket-read-only/build/lib.linux-x86_64-2.7/impacket
5M      ./impacket-read-only/build/lib.linux-x86_64-2.7
5M      ./impacket-read-only/build
2M      ./wpscan/spec/samples
2M      ./wpscan/spec

Using apt to check what updates are available for your Ubuntu or Debian system.

ubuntu ~/Documents $ apt list --upgradable

This command will install all pending updates to your Debian/Ubuntu system.

ubuntu ~/Documents $ sudo apt upgrade
1 responses to “More useful UNIX commands.

Leave a Reply