We have learnt the following four commands
mkdir: creates a diretory
ls: lists the contetns of a directory
cd: Change directory
pwd: displays your present working directory
man: Displays help pages.
All the commands in linux come with a number of options, which often come very handy. If you did try looking at the man page for any of the commands that we learnt in the previous chapter, you would have seen a lot of options listed for all of them.
We will learn some of the important options for each of the commands, the rest of them am sure you will learn yourself when you feel the need for it.
The standard format for passing the options to a command is
command -"options" "arguments"
Please note the "-" its required.
There are not many options with this command but one useful one we can look into currently is the -v.
just "mkdir" does not tell us whether the folder was created successfully or not so if you want to see if the folder was indeed created or not, use the option -v
user@desktop:~$mkdir -v folder2
mkdir: created directory `folder2`
"ls" comes with a huge number of options. We will learn a few most commonly used.
The "-l" option with "ls" gives more detailed listing of the contents of your folder. That is information like when was the file edited, how big is it etc.
user@desktop:~$ ls -l
drwxr-xr-x 2 user user 4096 2010-04-09 14:16 folder1
drwxr-xr-x 2 user user 4096 2010-04-09 14:16 folder2
- The first column having the fields with letters r,w etc represent permissions we will understand that a little later
- Second column is the number of links, don't bother about it now.
- Third column is the username of who created the file.
- Fourth column is the Group name to which the user belongs to (More on this later)
- Fifth coumn is the size of the folder or file
- Sixth column is the date on which it was last modified
- Seventh column is the time at which it was modified
- Eight column is the name of the folder file etc.
There are a lot more options with "ls", once we learn how to create files will look into a few more of them.
Most often, there will be no manual entry for cd, that is because it comes built in with bash(Bourne Again shell) and is not a seperate executable like other
One useful information to be aware while using cd is how to go back folders.
user@desktop:~$ cd folder1
We are in folder1 now, what if we want to come out of folder1 and got to folder2?
use ". ." (yes two dots) with cd
user@desktop:~/folder1$ cd ..
user@desktop:~$ cd folder2
or a shorter way of doing it is.
user@desktop:~/folder1$ cd ../folder2
So that was a little introduction to the options available with the basic commands that we have learnt. Hope it has been smooth until now.
Lets look to a few more commands in the next chapter.