Skip to main content

Linux- Lesson Primary(simple steps to feel Linux easy)

                                                         SIMPLIFIED LINUX

Tip Number 1: This is the most important tip I want to give you fellows.

                                  PRACTICE WHAT YOU STUDY

Red Hat/Cent-OS Terminal Commands

Before studying these commands isn’t it necessary that you should know how to open the

Here is the way.

In the top bar, click Application -System Tools - Terminal

Or for smart guys :)

If you wish to open terminal without using mouse, then press Alt+f2, then type gnome-terminal

 just left click and click open in terminal

1. pwd - It stands for Present (Print) Working Directory. It shows where we are now standing while in

Syntax for the pwd: pwd

To know the present working directory just type ‘pwd’ without quotes.

2. touch - It is used to create a file in the Linux.

Syntax for touch : touch file name

E.g. : touch sample_file.txt

The above command will create a file called samplefile.txt in the present working directory.

From now onwards keep in mind ‘pwd’ stands for Present (Print ) Working Directory.

To create a file in a place outside the pwd() the syntax is

touch path/file-name. extension

E.g. : touch /home/user1/file1.txt

We can create multiple files using the touch command. One example is shown below:

touch /home/user1/file1.txt <space> /home/user1/file2.doc

You must add space between the first and second path. Ok.. :)

I hope you have noted that space should be added in between touch and the starting of the path;

i.e. between touch and /home/user1/file1.txt at here. For every touch command this is the format.

In Linux a file can also be created without including a file extension:

E.g.: touch hello

The above command will create a file hello in the pwd.

3. cd - The command ‘cd’ stands for change directory. This command is used to change our current

location. That is to change the pwd ;
 cd command is used.

Syntax: cd location

E.g.: cd /home/user1

4. ls – The command ‘ls’ stands for list. As the name suggest the command is used for listing; listing the

contents of a given location. That is to show what all things are in a given location or path.

Please keep in mind: The content of location is different from the contents of a file or folder
Syntax: ls location

E.g.: ls /home/user1

Like ‘touch ‘ ; ls can also be used with multiple locations given.

E.g.: ls /home/user1<space> /home/user2

There are different options that can be used with ls that is known as the switches of the ls command.

Many commands have switches with them. I am gonna say some of them. Detailed description about

them can be found in then man page of the ls.

To open a man page syntax is given here:

Syntax: man ‘command name’

Give the command name with out quotes

E.g. : man ls

The switches that can be used with ls are:

1. -l : To list the files and folders in the parent folder with the properties.
2. -a : To show the hidden files also with the files in the folder
3. -C : To show the files in the column wise manner. That is from top to bottom view.
4. -d : To show only the directories in a folder.
5. -x : To show contents alphabetically in row wise
6. -g : Similar to -l but do not show the owner of the displayed contents
7. -h : Used in combination with -l and use if for displaying file size in human readable format.
8. -i : Shows the inode of displayed contents(inode- a number created when creating a file/folder/any
element in Linux)
9. -r : Shows the reverse order while sorting. Used in combination with -l
10. -S : Shows the files in sorted order based on size
Please refer the man page for the rest..
E.g. ls -l
ls -ls
ls -d

5. clear – The command is used to clear the screen.

Syntax: clear

E.g.: clear

The screen at here is the terminal screen. The place where we type our commands.

Short cut for clearing the screen- Ctrl + l

6. mkdir- The command is used to make a folder/directory in the Linux.

Syntax : mkdir directory_name

The above command will create a folder/directory in the pwd ; i.e. where we are standing in

E.g.: mkdir sample_folder

To create a directory somewhere else other than pwd e.g. is shown below

E.g.: mkdir /home/user33/folder3

The command mkdir can also be used to create multiple directories similar to ls and touch.

Syntax: mkdir <space> path/folder_name <space> path/folder_name

E.g.: mkdir /home/user1/fold1 /home/user2/fold2

5. rm – remove

The command rm is used to remove a file/empty directory. i.e. An empty folder/directory or a file.

Syntax: rm <space> file name

E.g.: rm file1.txt

rm file2.txt<space> file3.txt

To delete a non empty directory use the following syntax:

rm –r <file name>

r – here r stands for recursion. i.e. to delete files and folders inside the non-empty folder/directory.

More info is on the way...
Please refer and help me make this better friends.
                                                                            Waiting for your valuable feedback

Popular posts from this blog

Qmail cheat sheet

1) To check the mail queue in plesk from command line, you can use the command :


2) You can examine the queue with qmail-qread.


3) From the qread command you get the message id . In the above example , let us assume one of the id is 524514 . Now you can find the file holding the email in/var/qmail/queue with find command.

# find /var/qmail/queue -iname 524514


/var/qmail/queue/mess/22/524514 (mail headers)


4) From the mail header you get the IP address

vi /var/qmail/queue/mess/22/524514


Shortcut for the cool guys

find /var/qmail/queue -iname queu_id | grep mess | xargs less


4) If you wish …

Logical volume vmxxxx_img is used by another device - Error on LVM removal

Hi Folks,

I've faced error while trying to remove an LVM from the server.

The exact LVM error will be "Logical volume vmxxxx_img is used by another device" on executing the lvremove command.

Feel free to remove the following steps to remove the LVM from the server.

Note: Please remember to replace <id> with your VMID in the below section.

dmsetup ls dmsetup info -c xen-vm<id>_img dmsetup remove xen-vm<id>_img lvremove -f /dev/xen/vm<id>_img ----------------------------------------------------------

Open VZ cheat Sheet


vzctl set 101 --diskspace 1000000:1100000 --save  To set diskspace for container with ID 101

vzctl set 101 --diskinodes 90000:91000 --save     To set inodes for container with ID 101

vzctl set 101 --quotatime 600 --save              To set quotatime for container with ID 101 (The time limit by

                                                       which container is allowed to temporarily exceed  its quota soft limits)

vzctl exec 101 df                                  To execute command df at the server with the CTID 101

vzctl set 101 --quotaugidlimit 100 --save          Set number of user/group id's allowed for internal disk
                                                                     quota,if 0 UID/GUID quota will not be allowed\

 vzctl set 0 --dcachesize 5G --save        Set dcachesize of the hardware node

sysctl fs.fsync-enable=0     or  echo 0 > /proc/sys/fs/fsync-enable        disable fsync calls inside containers .

Add the  …