From Teknologisk videncenter
Basic UNIX/Linux Commands
On line help
On-line help commands
| Command |
Explanation |
Example
|
| man |
Se en kommandos manualside. |
Bash$ man find
|
| info |
Generel hjælp eller hjælp til enkelte kommandoer |
Bash$ info
|
| apropos |
Vis kommandoer som minder om en kendt |
Bash$ apropos chmod
|
| help |
Viser bash shellens indbyggede kommandoer |
Bash$ help
|
File handling
File handling commands
| Command |
Explanation |
Example
|
| cp |
CoPy - Kopier fil(er) |
Bash$ cp filA filB
|
| mv |
MoVe – Flyt eller omdøb en fil |
Bash$ mv filB filC
|
| ln |
LiNk – Opret en link til en fil eller bibliotek |
Bash$ ln filC filD
|
| rm |
ReMove – Slet filer og biblioteker |
Bash$ rm filA filB
|
| mkdir |
Opret bibliotek |
Bash$ mkdir heth
|
| rmdir |
Slet bibliotek. Skal være tomt |
Bash$ rmdir heth
|
Searching for Files and storage
File search and storage commands
| Command |
Explanation |
Example
|
| ls |
LiSt - Vis liste over filer og biblioteker |
Bash$ ls -asl
|
| pwd |
Print Working Directory - Vis nuværende arbejdsbibliotek |
Bash$ pwd
|
| find |
Søg efter filer og kataloger |
Bash$ find / –name filA
|
| du |
Disk Usage – Viser forbrug af diskplads |
Bash$ du /home/heth
|
| df |
Disk Free - Viser totalt forbrug/plads på diske |
Bash$ df
|
| cd |
Change Directory – skift arbejdsbibliotek |
Bash$ cd /home/heth
|
Working with files
commands to work with content of files
| Command |
Explanation |
Example
|
| cat |
concatenate – Vis fil |
Bash$ cat /etc/passwd
|
| more |
Vis fil en side af gangen. kan bladre frem |
Bash$ more /etc/passwd
|
| less |
Vis fil en side af gangen kan bladre frem og tilbage |
Bash$ less /etc/passwd
|
| head |
Vis første liner af fil |
Bash$ head /etc/passwd
|
| tail |
Vis sidste linier af fil – God til at se logfiler med dynamisk. Se option –f i manual |
bash$tail /etc/passwd
|
| cmp |
Compare – sammenlign to filer |
Bash$ cmp filA filB
|
| diff |
Difference – sammenlign to filer |
Bash$ diff filA filB
|
| cut |
Udvælg søjler i fil |
Bash$ cut –d: -f5 /etc/passwd
|
| wc |
Word Count – Tæl linier, ord eller tegn |
Bash$ wc –l /etc/passwd
|
| tr |
Translate – Søg og erstat tegn |
tr a-z A-Z
|
| grep |
Find linier med bestemt indhold |
Bash$ grep heth /etc/passwd
|
| sed |
Seriel Editor – Ofte brugt i scripts til editering af tekst
|
| file |
Vis hvad type af indhold filer har |
Bash$ file *
|
| pr |
Print Formatter – Formaterer tekst til print |
Bash$ pr –h ”rapport” filA
|
| vi |
Visual – Populær editor |
Bash$ vi filA
|
| pico |
Populær editor |
Bash$ pico filA
|
| emacs |
Populær editor |
Bash$ emacs filA
|
| tee |
split stdout fra et program i flere |
tee filB
|
User/Group rights and security
commands to work with security and rights
| Command |
Explanation |
Example
|
| su |
substitute – Skift brugeridentitet |
Bash$ su - heth
|
| newgrp |
Skift gruppeidenditet |
Bash$ newgrp elev
|
| who |
Vis aktive brugere |
Bash$ who
|
| w |
Vis aktive brugere |
Bash$ w
|
| finger |
Vis aktive brugere på denne eller en anden maskine. Er dog normalt slået fra via net, da hackere kan indhente informationer |
Bash$ finger root
|
| chown |
Change Owner – Skift ejer på fil/bibliotek |
Bash$ chown jens filA
|
| chgrp |
Change Group – Skift gruppe på fil/bibliotek |
Bash$ chgrp elev filA
|
| chmod |
Change Mode – Skift rettigheder på fil/bib. |
Bash$ chmod 640 filA
|
| chattr |
Change Attributes – skift udvidede rettigheder på et linux ext2/ext3 filsystem |
Bash$ chattr +A filA
|
| lsattr |
Vis udvidede attributes |
Bash$ lsattr filA
|
| passwd |
Skift passwd |
Bash$ passwd
|
| umask |
Sæt/vis standard fil-mode ved oprettelese af fil |
Bash$ umask 022
|
| id |
Vis login-rettigheder |
Bash$ id
|
Processes
commands to work with processes
| Command |
Explanation |
Example
|
ps || Process Status || Bash$ ps –alf
kill || Dræb en process || Bash$ kill –9 1123
nice || Juster process-prioritet || Bash$ nice –n 18 myjob
top || Vis processer og aktivitet interaktivt || Bash$ top –S
shutdown || Luk systemet ned. (Kun superbruger) || Bash$ shutdown –h 10
init || Skift kørselsniveau || Bash$ init 3
exit || Afslut shell (bash) || Bash$ exit
last || Vis login-historie || Bash$ last –x
uptime || Vis hvor lang tid siden maskinen bootede || Bash$ uptime
pstree || Vis ”familietræ” over processer || Bash$ pstree –p
procinfo || ||