Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Entrambe le parti precedenti la revisione Revisione precedente Prossima revisione | Revisione precedente | ||
vlsi:unix_basics [13/03/2013 23:56] pacher |
— (versione attuale) | ||
---|---|---|---|
Linea 1: | Linea 1: | ||
- | ====== UNIX basic commands ====== | ||
- | |||
- | == Contents == | ||
- | |||
- | * Introduction | ||
- | * bash and tcsh shells | ||
- | * Working with directories | ||
- | * Environment variables | ||
- | * Editing text files | ||
- | * Other Web tutorials | ||
- | |||
- | //[[http://www.bo.infn.it/alice/alice-doc/mll-doc/linux/admin/]]// | ||
- | |||
- | ===== Introduction ===== | ||
- | |||
- | Ce ne sono un sacco in giro per il Web, ma qui raccolgo SOLO il minimo indispensabile per lavorare, | ||
- | niente di superfluo! | ||
- | |||
- | only the bare minimum! | ||
- | |||
- | Familiarity with Linux is necessary | ||
- | |||
- | If you are not familiar with using Unix/GNU Linux this page is intended to provide a description of | ||
- | basic linux commands and references to more information. | ||
- | |||
- | When working in Linux, you will activate a **terminal** and inside the terminal **shell** will be running, i.e. a program interpreting your **commands**. Commands are typed inside this shell, and you press ENTER to issue them. For most commands, additional arguments can be issued by using minus signs (where \ signs are used in Windows), e.g. command -a - b -c or command -abc. To find out what options are available for a given command, and what those options do, type command --help, which works in most cases, or try to have a more detailed information with the man command. | ||
- | |||
- | |||
- | An exhaustive list of many other UNIX tutorials which can be found on the Web | ||
- | has been collected [[vlsi:unix_basics#other_web_tutorials|here]]. | ||
- | |||
- | ===== Bash and tcsh shells ===== | ||
- | |||
- | |||
- | ===== Working with directories ===== | ||
- | |||
- | |||
- | ^ **Command** ^ **Description** ^ | ||
- | |''<sub>man <command> </sub>''| | | ||
- | |''<sub>pwd </sub>''| | | ||
- | |''<sub>cd <dirName> </sub>''| | | ||
- | |''<sub>cd /path/to/directory </sub>''| | | ||
- | |''<sub>cd </sub>''| | | ||
- | |''<sub>cd .. </sub>''| | | ||
- | |''<sub>cd . </sub>''| | | ||
- | |''<sub>mkdir <dirName> </sub>''| | | ||
- | |''<sub>ls </sub>''| | | ||
- | |''<sub>ls -l </sub>''| | | ||
- | |''<sub>ls -althr </sub>''| | | ||
- | |''<sub>ls <dirName> </sub>''| | | ||
- | |''<sub>ls /path/to/dirName </sub>''| | | ||
- | |''<sub>mv <oldName> <newName> </sub>''| | | ||
- | |''<sub>mv <fileName> /path/to/newName </sub>''| | | ||
- | |''<sub>cp bla bla bla </sub>''| | | ||
- | |''<sub>rm <fileName> </sub>''| | | ||
- | |''<sub>acroread fileName.pdf </sub>''| | | ||
- | |''<sub>evince fileName.pdf </sub>''| | | ||
- | |||
- | |||
- | |||
- | Set alias in ''~/.cshrc'' file | ||
- | |||
- | |||
- | <code> | ||
- | alias ll 'ls -ahl' | ||
- | </code> | ||
- | |||
- | or in a ''~/.bashrc'' | ||
- | |||
- | <code> | ||
- | alias ll='ls ahl' | ||
- | </code> | ||
- | |||
- | ===== Viewing pdf files ===== | ||
- | |||
- | ====== Environment variables ====== | ||
- | |||
- | <code> | ||
- | export VarName=value # sh and sh-like shells (e.g. bash) | ||
- | </code> | ||
- | |||
- | <code> | ||
- | setenv varName value # csh and csh-like shells (e.g. tcsh) | ||
- | </code> | ||
- | |||
- | |||
- | <code> | ||
- | set varName=value | ||
- | </code> | ||
- | |||
- | |||
- | NOTA! variabili settate con set sono viste solo dalla shell, con setenv/export anche dai programmi! | ||
- | |||
- | ====== Find files ===== | ||
- | |||
- | <code> | ||
- | which <command> | ||
- | </code> | ||
- | |||
- | e.g. | ||
- | |||
- | <code> | ||
- | which cdsterm | ||
- | /usr/local/bin/cdsterm | ||
- | </code> | ||
- | |||
- | |||
- | <code> | ||
- | find /path/to/start/directory -name fileName | ||
- | </code> | ||
- | |||
- | <code> | ||
- | find | ||
- | </code> | ||
- | |||
- | ====== Text editors ====== | ||
- | |||
- | nano, vi, gedit, nedit | ||
- | |||
- | emacs, | ||
- | |||
- | <code> | ||
- | emacs -nw <fileName> | ||
- | </code> | ||
- | |||
- | |||
- | ===== Working with compressed files ===== | ||
- | |||
- | |||
- | Create a zipped file: | ||
- | |||
- | <code> | ||
- | zip fileName.zip fileName | ||
- | </code> | ||
- | |||
- | Extract a zipped file: | ||
- | |||
- | <code> | ||
- | unzip fileName.zip | ||
- | </code> | ||
- | |||
- | |||
- | |||
- | Create a gzipped file: | ||
- | |||
- | <code> | ||
- | gzip fileName | ||
- | </code> | ||
- | |||
- | Extract a gzipped file: | ||
- | <code> | ||
- | gunzip fileName.gz [gzip -d fileName.gz] | ||
- | </code> | ||
- | |||
- | |||
- | Create a .tar.gz archive: | ||
- | |||
- | <code> | ||
- | tar -czvf fileName.tar.gz /path/to/directory | ||
- | </code> | ||
- | |||
- | |||
- | Extract a .tar.gz archive: | ||
- | |||
- | <code> | ||
- | tar -xzvf fileName.tar.gz | ||
- | </code> | ||
- | |||
- | Create a .tar.bz2 archive: | ||
- | <code> | ||
- | tar -cjvf fileName.tar.bz2 /path/to/directory | ||
- | </code> | ||
- | |||
- | Extract a .tar.bz2 archive: | ||
- | <code> | ||
- | tar -xjvf fileName.tar.bz2 | ||
- | </code> | ||
- | |||
- | |||
- | |||
- | Extract a .rar file: | ||
- | <code> | ||
- | unrar fileName.rar | ||
- | </code> | ||
- | |||
- | |||
- | ===== Other Web tutorials ===== | ||
- | |||
- | * //[[http://www.ee.surrey.ac.uk/Teaching/Unix/]]// | ||
- | * //[[http://www2.ocean.washington.edu/unix.tutorial.html]]// | ||
- | |||
- | |||
- | \\ | ||
- | ---- | ||
- | |||
- | Last update: [[ pacher@NOSPAMto.infn.it | Luca Pacher ]] - Mar 13, 2012 |