Some more useful Linux commands for the desktop and server user.

Posted: July 15, 2014. At: 2:09 PM. This was 3 years ago. Post ID: 7355

This simple command allows the user to print the contents of a variable.

homer@deusexmachina:~ % echo "$LOGNAME"
homer

Use the netstat command to get information about all network connections to and from your machine.

homer@deusexmachina:~ % netstat
Active Internet connections
Proto Recv-Q Send-Q Local Address          Foreign Address        (state)
tcp4       0      0 192.168.233.133.ssh    vrrp.uglsmts51mg.50529 ESTABLISHED
Active UNIX domain sockets
Address  Type   Recv-Q Send-Q    Inode     Conn     Refs  Nextref Addr
fffff800029ff4b0 stream      0      0        0 fffff800029ff5a0        0        0
fffff800029ff5a0 stream      0      0        0 fffff800029ff4b0        0        0
fffff800029ffb40 stream      0      0 fffff800028db1d8        0        0        0 /var/run/devd.pipe
fffff800029ff3c0 dgram       0      0        0 fffff800029ff960        0 fffff800029ff690
fffff800029ff690 dgram       0      0        0 fffff800029ff960        0 fffff800029ff870
fffff800029ff780 dgram       0      0        0 fffff800029ffa50        0        0
fffff800029ff870 dgram       0      0        0 fffff800029ff960        0        0
fffff800029ff960 dgram       0      0 fffff800029f8b10        0 fffff800029ff3c0        0 /var/run/logpriv
fffff800029ffa50 dgram       0      0 fffff800029f8ce8        0 fffff800029ff780        0 /var/run/log

Do you want to see how much free space there is on your hard drive? use the df -Hla command to get this information.

homer@deusexmachina:~ % df -Hla
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/da0p2     19G    1.5G     16G     8%    /
devfs         1.0k    1.0k      0B   100%    /dev

This command gets the IP address of a host and feeds it to the host command.

homer@deusexmachina:~ % host `dig +short john.com`
212.156.252.162.in-addr.arpa domain name pointer perfora.net.

No comments have been made. Use this form to start the conversation :)

Leave a Reply