Feb 4, 2011

Some basic linux commands 1

First steps with linux shell.


Path

In linux there absolute and relative path.
An absolute path is from the root directory /. If you are in /tmp and want to do something with /home/myuser the absolute path is /home/myuser.
A relative path is the path from your current position. For example ../home/myuser


ls

With ls you can list (LiSt) the current directory. This basic tool shows you its content.
You could use the -l parameter to show the files with some informations like size or owner.
If you append the -a parameter you could see the hidden files. (Files and directories that start with a dot: .hidden)
If you want to use both parameter you could do:
ls -la or ls -l -a or ls -al or ls -a -l


pwd

pwd shows the full path of your current directory


cd(Change Directory)

With cd you could change your current directory.
cd ../ or cd /home/myuser


rm (ReMove)

With rm you could delete files. rm /path/to/file.
If you want to delete a directory you have to use the -R parameter.
rm -R /tmp/delete


mv (MoVe)

With the mv command you could move or rename a file.
mv /tmp/old /tmp/new


cat

The cat command allows you to view the content of a file.
cat /etc/passwd

No comments:

Post a Comment