Most commonly used basic Linux commands

Tram Ho

1 netstat

This command I use to check if the port of the service is open or not. I usually use this command in combination with the grep command to check the port of the service.

nestat -an | grep <port>

When that service works, it will display as follows (here I grep 5901 port vnc)

https://bkhost.vn/blog/lenh-netstat/ – Here you can learn about the syntax and options of the netstat command, including how to show all connections and listening (- a), display list of TCP connections (-t), display list of UDP connections (-u), display statistics of network protocols (-s) and much more.

2 free

This command is used to check ram information, providing information about used and unused memory, along with information about SWAP virtual RAM capacity.

I always add the -h option for easy viewing.

free -h

3 df

This command is used to display information about the file system and disk space, I use the -h option to display the disk space in a more readable unit than GB. See more details of this command at – https://quantrimang.com/cong-nghe/lenh-df-trong-linux-kem-en-du-167650

df -h

I only use this sentence alone, I don’t use much more

4 hostnames

The hostname command in Linux is used to display or name the computer.

When I installed linux, I already gave it a name, so I rarely change the name during the process that the product is running.

hostname

Usually I just use this command but do not add any options, you can learn more about this hostname command through the command:

man hostnam

Or refer to the link: https://www.geeksforgeeks.org/hostname-command-in-linux-with-examples/

5 ifconfig

The ifconfig command is used to display information about network devices such as IP address, MAC address, subnet mask, gateway, etc. This command is used to identify active network devices and related information. regarding network connectivity.

I often use the following grep command in combination to see the server’s ip:

ifconfig | grep inet

Show as picture

6 top

The top command is used to view detailed information about the processes running on the system, indicating parameters such as system resources (CPU, RAM, swap), uptime, process ID. , username, priority, CPU time,… I use this command, it’s similar to looking on the taskbar.

Show as picture

Type command

top

Conclude

Oke I’m too lazy today so I’ll just write it here, in the future there will probably be a 3rd part, or a whole season about these commands kkkk. You may find I don’t go into much detail about the commands. Just say what you actually use. It’s okay if you read too much but don’t use it all. Mainly to see if it can handle your current problem.

If you haven’t seen part 1, click here .

See more at: https://beatcomputer.com/

Source from myself + ChatGPT :v

Share the news now

Source : Viblo