Today, I will be with Comprehensive Linux VPS Commands From A to Z. I hope you read and enjoy this post to learn some of the Linux Commands together.
Comprehensively learning Linux Commands is the first and most important step you should take as a server administrator in learning and mastering Linux.
Unlike Windows operating systems, Linux has compelling flexibility in using server-side commands so that a fully professional Linux server can be managed remotely without the need for a graphical environment, which will be impossible or very, very difficult for Windows.
You can use these commands in your local Linux system, or you can buy Linux VPS and do these tests on it.
Basic Linux Command Tutorials Part 1
In Linux, everything is subdivided into a series of files and directories. The directory structure (the same folders as Windows) in Linux is an inverted tree, as shown in the picture below.
Each directory contains a series of directories and other important system files that perform essential Linux tasks.
By knowing the Linux commands, you will execute specialized operations on these sections or install and run specific services on Linux.
Step One
Getting Started with Linux OS Starts with a Linux installation tutorial. Our recommendation is to have a full-fledged Linux instruction tutorial, followed by a specialized training course for Linux administrators in the future.
We will try to give you every example of the instruction we use to give you a clear example of how to use it in Windows to understand the functionality of each command perfectly.
One of the first things you need to know in Linux is how to open files, you open the file in Windows by double-clicking on the item you want, and in Linux, this can be done with the cat command. First, we write the cat command, and then we enter the path of the corresponding file.
cat /etc/passwd cat /proc/meminfo
If you want to get accurate information about your Linux server, check out the following commands.
cat /proc/cpuinfo cat /proc/meminfo cat /proc/swaps
The first command shows CPU information and the number of cores. The second command shows RAM (Random Access Memory) Details, and the third command shows information about the amount of SWAP file.
If you want to see the date and time set on your server, the date and time output can be obtained with the date command.
date
You can use the following command to display all the slots connected to the system (to remind: slots are like card-mounted hardware installed at specific locations on the server, such as a graphics card in the case of personal systems).
lspci
The following statement is also used to display the number of USB-type hardware connected to Linux, such as checking the number of USB-connected USBs on my computer.
lsusb
You can use the following command to get information about the kernel or Linux kernel distribution and version.
uname –a
You can also use the following command to set the clock on the server bios.
clock –w
Important Note
In Linux, for more information on each command and how to use the switches, use the pre-command man commands and read the user guide exactly to get very detailed information about the command.
For example, we would like to get the cat command prompt as follows in the command line environment.
man cat
It was the finish of the first section of our topic. Stay with me in the next section.
Basic Linux Command Tutorials Part 2
In this section, we will explain a series of hardware management commands that can help you control your server’s status on, off, and off.
The first command is init that allows you to change the way the server operates. 6 mods are defined for this command.
Mode 0 mod to bring the system to shutdown mode.
Mode 1 is a single-user, and it is usually used for recovery.
Mode 2 mod is for multi-user.
Mode 3 mod is for multi-user with networking.
Mode 4 mod is unused and undefined.
Mode 5 mod is the graphical mode of the system.
Mode 6 is bringing Linux to reboot like when you enter a reboot command.
init 0 init 1 init 2 init 3 init 5 init 6
The next is the logout command, which acts like when you log out graphically from Windows.
logout
The reboot command does the same as restarting in Windows.
reboot
The shutdown command also shuts down the system, but it could perform a different function; for example, it would reboot the system.
shutdown -r now
Let’s take a good look at the Linux command line management and control of Linux’s directories to see how we can work with directories.
The first command is one of the most important and most commonly used. That is the cd command, which is the abbreviation for the words change directory, which means you should use this command when you want to move from one path to another directory on Linux.
In the following command, wherever we are, Linux will enter the home directory with this command. Maybe you have a question about what this directory is for. I should say that this directory holds information about each user.
cd /home
groupdel groupname
Sometimes it is necessary to change the information of a user group, such as its name. For this purpose, a groupmod command has been set, which you can use in the following format.
groupmod -n Testgroup OperaVPS
In the command above, we changed the group name from Testgroup to OperaVPS.
The next most common command is the passwd command, which can change the password of each user. If you enter the ssh area with root access and enter this command only, the relevant user will obviously change the password.
The last important command is to add the user to the server, which I also used complete switches that I will explain to you later.
useradd -c “comment here” -g adm -d /home/user -s /bin/bash user
We define a comment by the c switch for the username, which of course is not necessary, we associate the username to its froup using g switch, and we specify the location of each username with d switch, and s switch defines the shell that the user should use.
We want to deal with file management commands in this section; we can use the following command to change a filegroup.
chgrp adm file
We change the file to the adm user group by the command above.
The next most important and useful command is the chmod command. This command can change the permissions of any file or directory. Here are the three symbols that you must learn for this command.
r means to read with number 4
w means to write with number 2
x means to execute with number 1
The next command is chown stands for change owner. Each file or directory is assigned to one owner and a group. You can change these two by the following command.
chown root:root file
If you want to change the owner of all the files or directories in the directory, you want to use, use the -R switch as below.
chown –R root:root directory
Compress and unzip files.
To extract .bz2 compressed files, you can use bunzip2 as follows.
bunzip2 file.bz2
You can use the following command to compress a file with the bzip2 extension.
bzip2 file
To unzip the file with the .gz extension, you can use the following command.
gunzip file.gz
The following command is used to compress the file with the .gz extension.
gzip file
You can use the following command to compress a file with the maximum compression.
gzip -9 file
To compress a file with a rar extension, you can also enter the following format.
rar a file.rar file
You can also enter the following command to unzip a file.
rar x file.rar
Create an uncompressed .tar file.
tar -cvf archive.tar file
To unzip a .tar.gz file. You can use the following command.
tar -xvfz archive.tar.gz
You can use the following command to uncompress a .zip file.
unzip file.zip
This was the finish of the Fourth Part Of Linux Command Tutorials.
This post will be updated every week.