Saturday, January 16, 2010

Practicing Linux commands

लिनक्स संबंधी सभी डाउन लॉड्‍स के लिए निम्न लिंक क्लिक करें:


हिन्दी लिनक्स ब्लॉग का एड्रेस:

mkdir

This command is used to create directory. We can create several directories level at once, if we choose so. We also can assign permissions on newly created directory. Few of mkdir commands are shown here:

Command Details

mkdir /home/anil/ajai It will create a directory named ajai in /home/anil directory

mkdir -m 775 /home/anil/ajai It will create a directory ajai within /home/anil with rwx

permissions for owner and group members, but r-x permission

for others.

mkdir -p vijai/vinai It will create directory vinai. If vijai directory does not exist, -p

switch will create this directory too. Here both the directories are

created as subdirectories of current directory.


pwd

Present working directory, command is used to show the path of current working directory. This command does not require any argument or switch. Simply type pwd and we will get the out put some what like - /home/anil/ajai, which means currently we are within the directory ajai which is under /home/anil directory.


Cat

Concatenate ( cat ) command is used to display the contents of a file, i.e. to send the text to standard output. We also can use it to read multiple files. We can create a new file, over write old or even append an old file as well, but can not modify them.

Command Details

cat myfile1 It will display the contents of myfile1 file

cat myfile1 myfile2 It will display the contents of both the files one by one

cat > myfile3 It will create myfile3 in current directory. if it doe not exist.

Otherwise it will overwrite old myfile3

To save and exit, just press ^z on the next line

cat >> myfile4 It will create myfile4 in current directory, if it doe not exist,.

Otherwise it will append the contents in old myfile4


more

This command allows us to view the contents of a file page by page. It does not allow us to go back on the page.

Command Details

more myfile4 It will display contents of file myfile4 one page full. Once we are through, we can press space bar once to go one page ahead.

cat myfile4 | more Pressing enter key lets us move line by line


less

This works like more command but it also allows us scrolling up and scrolling down the file. Both commands, more and less start from top of the file. We can use following command within less:


Command Details

space To go forward one page in screen

4z To go forward 4 lines in the file. We can use any number.

/anil To search the text anil in the current file. We can search any

text.

page down To go forward one page

page up To go back one page

No comments:

Post a Comment