Introduction to UNIX #
- What is UNIX?
- Where do we find UNIX nowdayas?
- Linux
- Android
- Cloud (AWS, Google)
- Raspberry PI
- *BSD (networking)
- MacOS
- Linux
- CLI vs. GUI
- Terminal/Console
- Start a terminal
- Linux: CTRL + ALT + t
- Start a terminal
- Basic Commands
- print working directory
m@t14s:~$ # prompt string (user@hostname:directory$) m@t14s:~$ pwd /home/m
- changing directory
m@t14s:~$ cd Desktop # change to a relative path m@t14s:~/Desktop$ cd # go to home directory (~) m@t14s:~$ cd - # go to previous directory /home/m/Desktop m@t14s:~/Desktop$ cd /tmp # change to absolute path m@t14s:/tmp$ cd ~/Desktop/ # to Desktop in home directory m@t14s:~/Desktop$
- create directory
m@t14s:~$ mkdir sandbox
- list a directory (
ls
)m@t14s:~$ cd sandbox m@t14s:~/sandbox$ m@t14s:~/sandbox$ echo 'python("Hello World!")' > hello.py m@t14s:~/sandbox$ ls # list a directory: short hello.py m@t14s:~/sandbox$ ls -l # long listing total 4 -rw-rw-r-- 1 m m 21 Feb 5 10:51 hello.py
- show a file (
cat
)m@t14s:~/sandbox$ cat hello.py print("Hello World!")
- run a python script (
python
)m@t14s:~/sandbox$ python hello.py Hello World!
- copy/copy/remove a file
m@t14s:~/sandbox$ cp hello.py hello2.py # copy file m@t14s:~/sandbox$ ls hello2.py hello.py m@t14s:~/sandbox$ mv hello2.py hello_copy.py # rename file / directory m@t14s:~/sandbox$ ls -l total 8 -rw-rw-r-- 1 m m 21 Feb 5 10:51 hello_copy.py -rw-rw-r-- 1 m m 21 Feb 5 10:51 hello.py m@t14s:~/sandbox$ rm hello_copy.py # remove file
- print working directory
- Useful CLI keys
- CTRL + d (EOF)
- CTRL + c
- up/down
- CTRL + r
- TAB (autocompletion)
- CLI Text editor
- nano
Exercise #
- Go to
~/sandbox
and usenano
editor that will create a python filehello_me.py
that when executed, will print out your name. - Cleanup after yourself. You could delete
hello_me.py
. Better is to move it to/tmp
, where it will be deleted after reboot.
Resources: #
- https://linuxsurvival.com/ - practice UNIX basics here