Wednesday, 4 May 2011

Basic linux commands

hi,

today i am going to learn some basic linux commands,

first i am goin to see 'echo' command...

but first we should know that commands are case-sensitive,and most commands take arguments(parameters).

now lets see about 'echo' command.

ECHO:

The echo command is used to display or print its arguments(parameters)

Eg: echo basic linux commands

basic linux commands

ok now it prints its arguments as it is,

lets try echo itself as a argument...

Eg: $ echo echo

echo

ok it just prints echo. so echo prints the arguments, whatever it may be...

CAT:

The cat command is used to create and display the contents of a file. after entering the contents press ctrl+d.

Eg: $ cat > hello.txt

hello world

any one there

$ cat hello.txt

hello world

any one there


so,it "cat > filename" is used to create a file and "cat filename" is used to display the contents in the terminal.

LS:

The ls command is used to list the files and directories in the current working directory.

Eg: $ ls

hello.txt

word.txt

parthi

RM:

The rm command is used to remove the file or folder.

Eg: rm hello.txt

no output message appears. that s because it does its job silently.only throws messages when there is some problem in deleting the given file.

let s see when we try to delete a file which is not there.

Eg: rm hello.txt

rm: cannot remove `hello.txt': No such file or directory

fine. lets move on to cp (i.e) copy command...

CP:

The cp command is used to copy file from one file to another or one place to another

Eg: cp word.txt hello.txt

since there is no file named hello.txt in present folder cp commands creates and copies the contents from word.txt. if the file hello.txt is already present in directory it overwrites the file.

No comments:

Post a Comment