Introduction to Unix CLI: Difference between revisions
No edit summary |
m →mkdir |
||
| Line 52: | Line 52: | ||
</pre> | </pre> | ||
===mkdir=== | ===mkdir=== | ||
''mkdir'' | ''mkdir'' command creates (makes) directories if they do not exist. | ||
<pre>$ mkdir build | |||
$ # Create a whole directory structure | |||
$ mkdir -p ~/build/wrf/3.7 | |||
</pre> | |||
{{expand}} | {{expand}} | ||
[[Category:Hexagon]] | [[Category:Hexagon]] | ||
[[Category:Fimm]] | [[Category:Fimm]] | ||
Revision as of 09:18, 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 shell bash (1) - GNU Bourne-Again SHell bash [sh] (1) - GNU Bourne-Again SHell capsh (1) - capability shell wrapper chroot (1) - run command or interactive shell with special root directory chsh (1) - change your login shell …
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
mkdir
mkdir command creates (makes) directories if they do not exist.
$ mkdir build $ # Create a whole directory structure $ mkdir -p ~/build/wrf/3.7