
The pwd command displays the directory where the user is currently located. (pwd stands for “print working directory”). For example, typing
pwd
while in the Desktop
will show /home/[username]/Desktop
.
Note
Konsole toont deze informatie ook in het tabblad en in de titel van het venster.
The cd command changes directories. (cd stands for “change directory”). When a terminal window is opened, it will be in the user's home directory. Moving around the file system requires the use of the cd.
To navigate into the root directory, type:
cd /
To navigate to the current user's home directory, type:
cd
or
cd ~
Note
Het ~ teken staat voor de persoonlijke map van de gebruiker. Zoals hierboven aangegeven is cd ~ gelijk aan cd /home/gebruikersnaam/. Als u echter een opdracht als root uitvoert (bijvoorbeeld met sudo) verwijst ~ naar
/root
. Wanneer u cd met sudo uitvoert moet het volledige pad naar de persoonlijke map gegeven worden.To navigate up one directory level, type:
cd ..
To navigate up two directory levels, type:
cd ../../
To navigate to the previous directory (go back), type:
cd -
U kunt het volledige pad van een map weergeven om in een keer door verschillende mappen heen te gaan. Als u bijvoorbeeld
cd /var/log
typt gaat u direct naar de
/log
-submap van/var/
. Als ucd ~/Bureaublad
typt gaat u meteen naar de
Bureaublad
-submap in de persoonlijke map van de huidige gebruiker.
The ls command outputs a list of the files in the current directory. (ls is short for “list”). For example, typing
ls ~
will display the files that are in the current user's home directory.
Wanneer u ls met de -l-optie gebruikt zal ook extra informatie getoond worden, bijvoorbeeld de rechten van het bestand, de eigenaar en meer.
Wanneer u ls met de -al-opties gebruikt zal de informatie die bij de -l-optie hoort getoond worden, maar dit keer ook voor verborgen bestanden (de a-optie).
De touch opdracht wordt gebruikt om het tijdstip waarop een bestand het laatst is geopend of aangepast te veranderen, of om een leeg bestand aan te maken. Als u bijvoorbeeld
touch foo
uitvoert zal een nieuw leeg bestand met de naam foo
aangemaakt worden. Als foo
al bestond zal touch de timestamp vernieuwen. De timestamp toont het tijdstip waarop een bestand het laatst werd aangeraakt (touched).
The mkdir command is used to create a new directory. (mkdir stands for “make directory”). To create a new directory named foobar
, type:
mkdir foobar
The cp command makes a copy of a file or directory. (cp is short for “copy”). To make an exact copy of foo
and name it bar
, type:
cp foo bar
To make an exact copy of the foo_dir
directory and name it bar_dir
, type:
cp -r foo_dir bar_dir
The mv command moves a file or directory to a different location or will rename a file or directory. (mv is short for “move”). To rename the file foo
to bar
, type:
mv foo bar
To move the file foo
into the current user's Desktop
directory, type:
mv foo ~/Desktop
This will not rename foo
to Desktop
because foo
is a file and Desktop
is a directory.
The rm command is used to delete files and directories. (rm is short for “remove”). To delete the file foo
for the current directory, type:
rm foo
rm zal standaard geen mappen verwijderen. Om een map te verwijderen moet u de -r-optie gebruiken (u kunt hiervoor ook -R of --recursive gebruiken).
rm -r foobar
,
rm -R foobar
en
rm --recursive foobar
zullen allen de map foobar
, en de inhoud van die map verwijderen.