To help you manage vps and linux servers more effectively, today I would like to guide you with some basic commands to administer the server.
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
![Basic Commands for VPS and Linux Server 6 [IMG]](https://tocdoviet.vn/uploads/tai-lieu/2013_07/linux-ssh.jpg)
Basic Commands for VPS and Linux Server
1. System related commands
exit: exit the command line window.
logout: same exit.
reboot: reboot the system.
halt: shutdown.
startx: start xwindows mode from a terminal window.
mount: mount the filesystem from a storage device into the home directory tree.
unmount: opposite to mount command.
/usr/bin/system-config-securitylevel-ui: Configure Firewall and SELinux
2. Command to view information
cat /proc/cpuinfo: Find CPU specifications
cat /proc/meminfo: Memory and information exchange page
lspci: View motherboard information
uname -r: View kernel version
gcc -v: Which compiler version do I have installed.
/sbin/ifconfig: View your IP addresses.
netstat: see all connections.
lsmod: What is loaded kernel module
last: see who has logged into the system
DF: View hard drive space
free -m: view memory usage
netstat -an |grep :80 |wc -l: see how many connections to port 80
3. Commands to manipulate files
ls: get a list of all files and directories in the current directory.
pwd: output the path of the working directory.
CD: change working directory to a new directory.
mkdir: create a new directory.
rmdir: delete empty directory.
cp: copy one or more files to a new directory.
mv: rename or move files or folders.
rm: delete file.
WC: count the number of lines, the number of characters… in the file.
touch: create a file.
cat: view file contents.
Because: start the vi text editor.
DF: check disk space.
du: view disk space used for certain files
tar -cvzpf archive.tgz /home/example/public_html/folder: compress a folder
tar -tzf backup.tar.gz: list compressed files gz
tar -xvf archive.tar: extract a tar file
unzip file.zip: extract the .zip file
wget: download a file.
chown user:user folder/ -RED: Change the owner for the entire directory to the file.
4. Commands when working on terminal
clear: clear the command line window.
date: view system date and time.
find /usr/share/zoneinfo/ | grep -i pst: see time zones.
ln -f -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime: Change the server time zone to Vietnam time zone
date -s “1 Oct 2009 18:00:00”: Adjust the time
calories: view system calendar.
5. System management command
rpm: check if a package is installed or not, or install a package, or use to remove a package.
ps: check system running process.
kill: stop the process when the process is suspended. Only the super-user can stop all processes, and the normal user can only stop the processes he created.
top: displays the activity of processes, especially information about system resources and the use of those resources by each process.
pstree: displays all processes as a tree.
sleep: for the system to stop working for a period of time.
useradd: create a new user.
groupadd: create a new user group.
passwd: change the password for the user.
userdel: delete created user.
groupdel: delete the created user group.
gpasswd: change the password of a user group.
su: allow login as another user.
groups: displays the group of the current user.
who: indicates who is logged into the system.
w: same as who command.
man: view command line instructions such as syntax, parameters, etc.
Note: Linux operating system is case sensitive.
Collection Information