Comanda cd vă permite să schimbaţi directorul de lucru curent (cd vine de la englezescul „change directory”). La deschiderea unui terminal vă veţi afla în directorul „acasă”. Exemple:
Pentru a merge la directorul rădăcină, tastaţi:
cd /
To navigate to your home directory, type:
cd
or
cd ~
To navigate up one directory level, type:
cd ..
To navigate to the previous directory (or back), type:
cd -
To navigate through multiple levels of directory at once, specify the full directory path that you want to go to. For example, type:
cd /var/www
to go directly to the /www
subdirectory of /var/
. As another
example, type:
cd ~/Desktop
to move you to the Desktop
subdirectory inside your home directory.
The pwd command will allow you to know in which directory you're located (pwd stands for "print working directory"). For example, typing
pwd
in the Desktop
directory, will show
~/Desktop
.
![]() |
|
The Xfce4 Terminal also displays this information in the title bar of its window. |
The ls command will allow you to see the files in the directory you are in (ls stands simply for "list"). Used with certain options, you can see sizes of files, when files where made, and permissions of files. For example, typing
ls ~
will show you the files that are in your home directory. Examples:
To list all the files (including hidden files), type:
ls -a
To list information in a long format, type:
ls -l
. This will include information about permissions, owner, and last modification time.
To list your root patition, type:
ls /
To list one time per line, type:
ls -1
The cp command will make a copy of a file for you (cp stands simply for "copy"). For example, type:
cp file foo
to make
a exact copy of file
and name it
foo
, but the file file
will still be there.
mv: The mv command will move a file to a different location or will rename a file (mv stands simply for "move"). Examples:
To rename a file named file
to foo
, type:
mv file foo
.
To move the file foo
to your Desktop
,
type:
mv foo ~/Desktop
. This will move foo but will not rename it. You must specify a new file name to rename a file.
![]() |
|
If you are using mv with sudo you will not be able to use the ~ shortcut, but will have to use the full pathnames to your files. This is because when you are working as root, ~ will refer to the root account's home directory, not your own. |
The rm will remove or delete a file in your directory (rm stands simply for "remove"). It will not work on directories which have files in them. To remove directories, you can use rm -r. The r stands for recursive. For example:
rm -r foo
will remove the directory named foo and all of its contents.
![]() |
|
Using rm -r will delete a complete directory and everything in it without further questions, so be careful with this command. |