Introduction to Unix CLI: Difference between revisions
m →man |
|||
| Line 30: | Line 30: | ||
/tmp/test/course2015 | /tmp/test/course2015 | ||
</pre> | </pre> | ||
===cd=== | |||
''cd'' changes the current working directory to the specified directory name. If no directory is specified than ''cd'' changes current working directory to users home directory. | |||
<pre>$ pwd | |||
/tmp/test/course2015 | |||
$ cd bin | |||
$ pwd | |||
/tmp/test/course2015/bin | |||
$ cd ../../src | |||
$ pwd | |||
/tmp/test/src | |||
$ cd ~/bin | |||
$ pwd | |||
/home/lorand/bin | |||
</pre> | |||
{{expand}} | {{expand}} | ||
[[Category:Hexagon]] | [[Category:Hexagon]] | ||
[[Category:Fimm]] | [[Category:Fimm]] | ||
Revision as of 09:08, 26 October 2015
What is Unix CLI?
Unix CLI is actually the shell, a text interface to the operating system. Shell interprets and executes your commands and their arguments by passing them to the operating system.
There are different shell variants, like bash, csh, ksh, sh, tcsh, etc., probably the most popular being bash. The name “bash” is an acronym for “Bourne Again SHell” and is an enhanced replacement for sh. In this short introductory we are going to cover bash.
Bash
Bash is an interactive and scriptable shell. Supports name expansion, wildcards and typing shortcuts.
Note: Interaction with bash is case-sensitive just like everything in Unix system.
Some useful shortcuts:
TAB, UP, DOWN, Ctrl+R, Esc+.
Popular commands
man
man is the system's manual pager. It is an interface to on-line manuals. man has it's own manual pager.
$ # Show default man page for top command $ man sleep $ # Show all manual pages for top command, successively $ man -a sleep
Whenever you are uncertain what a command does, what options and argument can be passed to, man is your friend.
apropos
apropos searches the manual page names and descriptions for the specified keyword.
$ apropos
pwd
pwd prints the full name of the current working directory.
$ pwd /tmp/test/course2015
cd
cd changes the current working directory to the specified directory name. If no directory is specified than cd changes current working directory to users home directory.
$ pwd /tmp/test/course2015 $ cd bin $ pwd /tmp/test/course2015/bin $ cd ../../src $ pwd /tmp/test/src $ cd ~/bin $ pwd /home/lorand/bin