Linux Basic Qs

1. How can you see which kernel version a system is currently running?
A: uname

arobel@:~$ uname
arobel@:~$ uname -v
#184-Ubuntu SMP Wed Oct 18 11:55:51 UTC 2017
arobel@:~$ uname -r

cat /proc/version
Linux version 2.6.32-696.23.1.el6.x86_64 ( (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Tue Mar 13 22:44:18 UTC 2018

2. How to check the IP address configured on the system?
A: ifconfig / ip addr show / ip addr show eth0

3. How do you check for free disk space?
A: df -ah (diskfree // all file system / human readable)

4. How do you manage services on a system?
A: service status/restart/start – service udev status
systemctl status

5. How would you check the size of a directory’s contents on disk?
A: du -sh (Disk used)

6. How would you check for open ports on a Linux machine?
A: netstat (big output) / netstat -tulpn (Tcp/upd/listening/port)

Note: use sudo id need more information

7. How do you check cpu usage for a process?
A: ps aux | grep / top(updated every 2sec ) decending order. / htop

8. Dealing with mounts?
A: ls /mnt
mount /dev/sda2 /mnt
mount (to verify)

less /etc/fstap (Disk partition / UUID/ Swap partition.

9. How do you look up something you don’t know?
A: man To check options of the command.

10. What do you do when can’t find an answer in man page?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s