Important Linux Commands for Beginners: Linux Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to the video tutorial on important linux commands in the last tutorial we learned the importance of using the command-line interface let us continue and learn the must know Linux commands to check a list of files on your UNIX or Linux system you can use the LS command it shows the files or the directories in your current directory let us check this on terminal by typing the LS command we can see all the files and directory in the home directory it is important to note here that the directories are denoted in blue color and the files are denoted in white you will find similar color schemes and different distributions of Linux the LS command shows files only in the current directory suppose you want to check the presence of an mp3 file in your music folder which is under the sub directory English and the sub directory hardrock in order to list this mp3 file you can use the LS r command it will show all the files and the folders not only in the directories but also the sub directories here we can see all the directories the sub directories and the files present in them to get very detailed information related to the files and directories you can type the LS space hyphen L command once you type the command you are presented with a lot of details on the screen let us learn what they are the first column here shows file type and access permissions the second column shows memory blocks occupied by the file or the directory the third column here shows the owner or the creator of the fire the fourth column displays the user group of the owner the fifth column shows the file size and bytes the sixth column here shows the date and the time of the creation of the file or the directory the seventh and the last column here shows the directory or the file name hidden items in UNIX or Linux begin with the period symbol at the start of the file or directory any directory starting with the period will not be seen unless you request for it to view hidden files use the command LS space hyphen a on typing this command on terminal we can see all the hidden files which start with a period symbol when it comes to creating and viewing files it's time to bring in the cat the cat command the cat command is used to display text files it can also be used to copy combine and create new text files let us see how it works on terminal to create a new file you need to type the following command on terminal file one here being the fire that we will create once you have entered the command terminal would prompt you to add the content let us add the content for this file once you are done adding the content for the file you need to press ctrl + D on your keyboard to return to the command prompt this is how we will create a new file using the cat command to view the same file you can type in cat space the file name let's create another file using the same method now we have two files here file1 and file2 let us try and combine them together the syntax to combine two files is cat space filename 1 space filename 2 which would then be outputted to a new file as soon as you insert this command and hit enter the files are concatenated but you do not see a result this is because the bash shell or the terminal is silent type it will never give you a confirmation message like OK or command has been invoked it will only show a message when something goes wrong or when an error has occurred in order to view the new combo file new file let us use the same cat command please note that only text files can be displayed and combined using the cat command moving on to deleting files we will use the RM space filename command for deleting the files that we do not need let us look at it on terminal here we have a file with a name test which we would like to remove the RM command removes files from the system without confirmation to delete this file you need to type in RM space test this would delete the file and the next time we list the files in the home directory we would not see the test file for moving files to a new location you need to use and V space filename space mewn file location command suppose we want to move the test file to a new location home do nain nain files for this we need to execute this command running it will move the file but why does it say permission denied well the move command needs Super User permission currently we are executing the command as a standard user and we do not have the right permissions for the files directory hence we get the above error to overcome the error use the command sudo sudo program allows regular users to run programs with the security privileges of super user or root so the command will ask for password authentication you do not need to know the root password for this and you can enter your own password after authentication the system will invoke the requested command Suda maintains a log of each command run system administrators can track back the person responsible for undesirable changes in the system it should be noted here that by default the password that you entered for sudo is retained for 15 minutes per terminal this eliminates the need of entering the password time and again for renaming files use MV space filename space new file name let us rename the test file to a new one for this we need to type in MV space test1 a file name which would be test1 in this case once done we can list the files and we would see that the file name for test would be changed to test one this was about making changes to files let us now learn a bit about manipulating directories starting with creating directories this command will create a sub directory in your present working directory which is usually your home directory let's see how it works on terminal by typing mkdir command with the directory name we would be able to create a new directory here we will create a new directory named Psalms this is how we will create a new directory in the home directory if you want to create a new directory in a different 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 can see here we have a new music directory created under TMP you can also create more than one directory at a time let us run this command on terminal and look at the results for creating multiple directories you need to type in the MK dir command followed by the new directories that you would like to create here we would create three new directories as following running the LS command would show that these three new directories have been created under the home directory in order to remove a directory use the command rmdir space directory name now we want to remove the dir ec directory using the rmdir command for this you need to type the following but make sure that there is no file our sub directory under the directory that you want to delete delete the files and the sub directories first before deleting the parent directory by running the list command we would see that the dir ec directory has been deleted for renaming directories use the MV command which we covered earlier now we would like to change the name of direct to directory to a new one for this we need to run the MV command this is how we would do it on running the LS command we would see that the direct to directory has been renamed as direct for moving on to the man command man stands for manual which is a reference book of a Linux operating system it is similar to help file found in popular software to get help on any command that you do not understand you can type man space command the terminal would open the manual page for that command for example if we type man space LS command and hit enter terminal would give us information on the list directory contents command next is the history command history command shows all the commands that you have used in the past for the current terminal session this can help you refer to the old commands you have entered and reuse them in your operations again on terminal this command would give us the following output you can also press the up arrow key on your keyboard and go through the command that you have run before this way you can run them again next is the clear command this command declares all the clutter on the terminal and gives you a clean window to work on just like when you launch the terminal let us check how this command works here we have a terminal window with a lot of commands and their output now if you would like to clean this all up we can simply run the clear command and all of the commands and their output will be cleaned many a times you would have to type in long commands on the terminal well it can be annoying at times and if you want to avoid such a situation then copy pasting the commands can come to rescue for copying the text from the source you could use ctrl + C but for pasting it on the terminal you need to use ctrl + Shift + V key combination you can also try Shift + insert or select edit paste on the menu now let us quickly summarize all the commands learnt today the LS command lists all file and directories in the present working directory the LS are command lists files and subdirectories as well the LS a command lists hidden files the LS l a command lists files and directory with detailed information like permissions size owner etc the cat file name command creates a new file the cat file name displays the file content using this command you can join two files and store the output in a new file MV file new file path would move a file to its new location the next is the next is the MV file name new file name command which would rename the file to a new file name sudo is an important command and it allows regular users to run programs with the security privileges of the super user or root the RM command deletes a file the mkdir command followed by the directory name would create a new victory in the present working directory using the same command followed by the path and the directory name would create a new directory at the specified path rmdir would remove a directory from the system MV name new name would give a directory a new name the man command gives us help information on a command the next is history this command gives a list of all the past commands typed in the current terminal session the last one is the clear command which clears the terminal thank you for watching I will see you in the next tutorial
Info
Channel: Guru99
Views: 467,258
Rating: undefined out of 5
Keywords: linux, unix, commands, ubuntu, linux command line, linux commands, linux command line tutorial, guru99 linux, guru99 linux youtube, guru99 linux command, introduction to linux and basic linux commands for beginners, linux for beginners, linux basic commands with examples, linux basic commands, linux basic commands for beginners, commands in linux with examples, commands in linux, commands in linux for beginners
Id: _TlK0-5EJ-Y
Channel Id: undefined
Length: 15min 3sec (903 seconds)
Published: Mon Jan 28 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.