Important Linux Commands for Beginners: Linux Tutorial
Welcome to the tutorial video about important Linux commands In the last tutorial, we learned the importance of using a command-line interface Let's continue and learn must know Linux commands To check the list of files on a Unix or Linux system, you can use the "LS" It displays files or directories in your current directory.
Let's check it out on the station By typing the "LS" command we can see all the directory files in the main directory It is important to note here that the directories are blue and the files are encoded in white You will find similar color schemes and different distributions of Linux.
The "LS" command displays the files only in the current directory Let's say you want to check for an MP3 file in your music folder under the English subdirectory The Hardrock subdirectory In order to insert this MP3 file, you can use the "LS-R" All files and folders will appear not only in directories, but also subdirectories Here, we can see all the directories in subdirectories and files in them For very detailed information related to files and directories You can type the hyphen command "LS" space "-al" Once you type the command Many details are displayed on the screen.
Let's know what it is, the first column shows here the file type and access permissions The second column shows the memory blocks that the file occupies Or directory The third column shows here the owner or file creator.
The fourth column displays the owner's user group.
The fifth column shows the file size and bytes.
The sixth column shows the date and time the file or directory was created.
The seventh and last column displays the directory or file name here.
The hidden items in Unix or Linux begin with the period code at the beginning of the file or directory.
No evidence that begins with the period will be displayed unless requested.
To view hidden files, use the command Space "LS" hyphen "-a" To write this command on the station, We can see all the hidden files that start with the period code.
When it comes to creating and displaying files, it's time to bring the cat The "cat" command is used to display "cat" to display text files.
It can also be used to copy, combine and create new text files.
Let's see how it works on the terminal to create a new file you need to write the next command on the terminal.
Here we will mention the fire that we will create.
Once you enter the command station you will be asked to add content.
Let's add content to this file.
Once you have finished adding the file content You need to press "CTRL + D" on the keyboard to return to the command prompt So we'll create a new file using the "cat" To view the same file, you can type "cat" space.
Let's create another file using the same method Now we have two files here, "file1" and "File2" Let's try to combine them Syntax to combine two files "cat" space "Filename 1" Space "Filename 2" which is then output to a new file.
As soon insert this command and hit enter the connected files.
But you do not see the result, because the shell bash or terminal is a silent type.
It will not give you a confirmation message such as a command or command has been called.
It will only display a message when an error occurs, or when an error occurs In order to view the new new combo file file let us use the same command "cat" Please note that text files can only be displayed and merged using the "cat" Go to Delete Files We will use the "RM" filename to delete files that we do not need.
Let's take a look at the station We have here a file called "Test" which we would like to remove The RM command removes files from the system without confirmation To delete this file, you must type "RM" space "test" This will delete the file and the next time we insert the files into the home directory, we will not see the test file.
To move files to a new location you need to use them "" MV "space" file name "space" new file location "command Let's say we want to move the test file to Guru99 files in a new location That is why we need to implement this Run it, the file will be moved.
But why say permission is denied.
Well, the transfer command needs superuser permission.
Currently we are executing the command as a standard user and do not have the correct permissions for the file directory.
Hence we get the error above.
To overcome the error, use the "SUDO" command.
SUDO allows regular users to run programs with privileged or root security privileges.
"SUDO" will be required to authenticate the password.
You do not need to know this root password and you can enter your password After authentication, the system will call the required command.
SUDO keeps a record of each order, and system administrators can follow the responsible person For unwanted changes in the system.
Note that by default The password you entered for "SUDO" is retained for 15 minutes per terminal.
This eliminates the need to enter the password again and again.
To rename the files, use the "MV" "File Name" space for the "New File Name" Let's rename the test file to a new file.
For this, we need to write in the "MV" test area and file name Which will be test1 in this case Once this is done, we can insert the files and we will see that the file name of the test will be changed to a single test.
This was about making changes to the files.
Let us now learn a bit about manipulating directories.
Beginning with creating directories, this will create a subdirectory in the current working directory.
It is usually your home directory.
Let's see how it works on the station By typing the "mkdir" command with the directory name We will be able to create a new directory.
Here, we will create a new directory named Songs.
So we'll create a new directory in the main directory.
If you want to create a new directory in a location other than the home directory, you need to use the following command For example, typing the following command would create a new music directory under the "TMP" directory.
As we see here we have a new music guide created under Tmp.
You can also create more than one directory at a time.
Let's run this on the terminal and look at the results.
To create multiple directories, you need to type the command "mkdir" Followed by new directories that you want to create Here we will create three new guides as follows Running the "LS" command will show that these three new directories have been created under the home directory.
For manual removal Use the command "rmDir" The name of the space directory Now, we want to remove the "direc" directory using the command "RMDir" For this you need to write the following But make sur, e there is no file we have subdirectory under the directory you want to delete it.
Delete the files and subdirectories first before deleting the parent directory.
By running the menu command, we will see that the directory "dirEc" has been deleted To rename the directories, use the "MV" command that we previously covered.
Now we would like to change the name "Direct2" to directory to new directory.
For this we need to run the "MV" command.
This is how we will do it.
On the "LS" command, We'll see that "direct2" to "directory" has been renamed directly.
Go to the command "man", "Man" refers to a directory and is a reference book for the Linux operating system.
It is similar to the help file located in the popular program.
For help on something you do not understand, you can type a "man" space command The station will open the manual page for this command For example, if we type "man" for the "LS" space, press Enter A station that will give us information about the command list of directory contents The following is the "history" command The "history" command displays all the commands that you used earlier for the current Terminal Terminal session.
This can help you refer to the old commands, and you enter them and reuse them in your operations again.
On the station, this command will give us the next output You can also press the up arrow key on your keyboard and go to the command you previously played This way you can run it again next is the "clear" This command announces all the clutter on the station and gives you a clean window to work on.
Just as it happens when the device is turned on.
Let us check how this works.
Here, we have a terminal window with lots of commands and output.
Now if you want to clean this whole We can simply run the "clear" command and all commands will be cleaned up.
Many times you may have to write long orders on the terminal well that can be annoying at times And if you want to avoid such a situation Then copy paste commands can come to save To copy the text from the source, you can use "CTRL + C" But to be able to paste it on the device, you must use the key combination "CTRL + shift + V" You can also try "shift + insert" Or select edit -> paste in the list Now let's quickly summarize all the commands learned today The LS command lists all the files and directories in the current working directory The "ls-R" command lists files and subdirectories as well The "Ls-a" command lists the hidden files The "ls-la" command lists the files and the directory with detailed information Such as permissions, size, owner, ETC.
The "cat" file name command creates a new file The file name "cat" displays the content of the file, using this command you can combine two files And store the output in a new file "MV" is a new file, the Path file will move a file to its new location Next is The following is the new filename command "MV" file name that will rename the file to a new file name.
"SUDO" is important Regular users are allowed to run programs with security privileges for the superuser or root Command RM Deletes a file The "mKDir" command followed by the directory name will create a new victory in the current working directory.
Using the same command followed by the path The directory name creates a new directory in the specified path.
"rmdir" would remove the directory from the system.
The name "MV" is new, the name will give a new directory The "man" command gives us help information in a command.
Next is "History" This command gives a list of all the previous commands written in the current Terminal session.
Another one is the "clear" command that removes the station.
Thanks for watching I'll see you in the next tutorial.