-
Notifications
You must be signed in to change notification settings - Fork 5
UAI 655 Linux command line
The study guide is Linux Fun Because the target of the course is Python - you do not need to know all, we go through only basics. In the Bash Course you will find out also the previous Bash lectures. There is also a complete Ubuntu manual.
to start terminal
-Ctrl Alt t
We will play only with the command line.
-marta@marta-ubuntu: ~$ whoami
marta
-marta@marta-ubuntu:~$ hostname
marta-ubuntu
-marta@marta-ubuntu:~$ date
Po úno 13 14:24:40 CET 2017
-marta@marta-ubuntu:~$ uname -a
Linux marta-ubuntu 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
-marta@marta-ubuntu:~$ ls
Desktop Pictures
Documents Public
Downloads __pycache__
examples.desktop skype-install.deb
Geocaching Akční filmy u Chlumčan.odt skype-ubuntu-precise_4.3.0.37-1_i386.deb
IOS 655 Python a Bash Templates
jcupeople.aes upstart-udev-bridge.8092.pid
marta.py usb
Music Videos
-marta@marta-ubuntu:~$ ls -lga
total 39520
drwxr-xr-x 30 marta 4096 led 31 17:06 .
drwxr-xr-x 3 root 4096 pro 15 20:48 ..
-rw------- 1 marta 825 led 31 15:11 .bash_history
-rw-r--r-- 1 marta 220 pro 15 20:48 .bash_logout
-rw-r--r-- 1 marta 3637 pro 15 20:48 .bashrc
drwx------ 26 marta 4096 led 31 10:02 .cache
drwx------ 3 marta 4096 pro 15 21:12 .compiz
drwx------ 26 marta 4096 led 9 13:00 .config
drwxr-xr-x 2 marta 4096 pro 15 20:59 Desktop
-rw-r--r-- 1 marta 25 pro 15 20:59 .dmrc
drwxr-xr-x 2 marta 4096 pro 15 20:59 Documents
drwxr-xr-x 3 marta 4096 úno 13 13:51 Downloads
-rw-r--r-- 1 marta 8980 pro 15 20:48 examples.desktop
-marta@marta-ubuntu:~$ ls -lah | grep "txt\|py"
-rw-rw-r-- 1 marta marta 811 bře 31 2017 2html.py
-rw-rw-r-- 1 marta marta 0 úno 14 2017 amarta.txt
-rw-rw-r-- 1 marta marta 0 úno 14 2017 c43.txt
-rw-rw-r-- 1 marta marta 781 bře 31 2017 csv2html_marta.py
-rw-rw-r-- 1 marta marta 0 úno 14 2017 d53.txt
-rw-rw-r-- 1 marta marta 400K dub 6 11:06 dictionary.txt
-rw-rw-r-- 1 marta marta 437 dub 3 2017 duck_cipher.py
-rw------- 1 marta marta 35K kvě 23 13:25 encrmessage.txt_0.odt
-rw-rw-r-- 1 marta marta 4,0K bře 29 2017 geohashing 2.0 u Strapole.txt
-rw-rw-r-- 1 marta marta 78 dub 19 19:01 .~lock.studentcipher.txt#
-rw-rw-r-- 1 marta marta 47 úno 17 2017 marta.py
-marta@marta-ubuntu:~$ pwd
/home/marta
-marta@marta-ubuntu:~$ ps
PID TTY TIME CMD
8482 pts/1 00:00:00 bash
9408 pts/1 00:00:00 ps
-marta@marta-ubuntu:~$ ps -lga
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
4 0 1065 1052 20 0 537924 82920 - Ssl+ tty7 8:47 /usr/lib/xo
4 0 1094 1 20 0 16052 1888 - Ss+ tty1 0:00 /sbin/agett
0 1000 8482 8474 20 0 22848 5424 wait Ss pts/1 0:00 bash
4 1000 9409 8482 20 0 37476 3340 - R+ pts/1 0:00 ps -lga
-man ps
EXAMPLES
To see every process on the system using standard syntax:
ps -e
ps -ef
ps -eF
ps -ely
To see every process on the system using BSD syntax:
ps ax
ps axu
To print a process tree:
ps -ejH
ps axjf
To get info about threads:
ps -eLf
ps axms
To get security info:
ps -eo euser,ruser,suser,fuser,f,comm,label
ps axZ
ps -eM
To see every process running as root (real & effective ID) in user
format:
ps -U root -u root u
-marta@marta-ubuntu:~$ echo $SHELL
/bin/bash
-marta@marta-ubuntu:~$ echo $BASH_VERSION
4.3.46(1)-release
-marta@marta-ubuntu:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:21:70:ef:22:36
inet addr:192.168.20.8 Bcast:192.168.20.255 Mask:255.255.255.0
inet6 addr: fe80::57a6:340:c8e1:b287/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:246931 errors:0 dropped:0 overruns:0 frame:0
TX packets:169001 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:283260350 (283.2 MB) TX bytes:64995600 (64.9 MB)
Interrupt:22 Memory:f6ae0000-f6b00000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4384 errors:0 dropped:0 overruns:0 frame:0
TX packets:4384 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:750498 (750.4 KB) TX bytes:750498 (750.4 KB)
wlan0 Link encap:Ethernet HWaddr 00:21:5d:6e:25:ba
inet addr:192.168.20.15 Bcast:192.168.20.255 Mask:255.255.255.0
inet6 addr: fe80::221:5dff:fe6e:25ba/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12838 errors:0 dropped:0 overruns:0 frame:0
TX packets:1029 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1382312 (1.3 MB) TX bytes:176111 (176.1 KB)
-marta@marta-ubuntu:~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:21:70:ef:22:36
inet addr:192.168.20.8 Bcast:192.168.20.255 Mask:255.255.255.0
inet6 addr: fe80::57a6:340:c8e1:b287/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:248652 errors:0 dropped:0 overruns:0 frame:0
TX packets:170668 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:284117499 (284.1 MB) TX bytes:65542555 (65.5 MB)
Interrupt:22 Memory:f6ae0000-f6b00000
```
By shutting down the network interface and enabling it again, we force Debian to renew an
ip address from the bridged network. **It is commands for edministrators.**
```diff
+# do not run ifdown while connected over ssh!
-ifup -a
-ifdown -a
-ifup eth0
-access denied
-marta@marta-ubuntu:~$ ifup -a
ifup: failed to open lockfile /run/network/ifstate.lo: Permission denied
-marta@marta-ubuntu:~$ sudo -i
[sudo] password for marta:
-root@marta-ubuntu:~# exit
logout
-marta@marta-ubuntu:~$ sudo su
root@marta-ubuntu:/home/marta# exit
exit
-marta@marta-ubuntu:~$ man uname
UNAME(1) User Commands UNAME(1)
NAME
uname - print system information
SYNOPSIS
uname [OPTION]...
DESCRIPTION
Print certain system information. With no OPTION, same as -s.
-a, --all
print all information, in the following order, except omit -p
and -i if unknown:
-marta@marta-ubuntu:~$ man -k help
AptPkg::hash (3pm) - a helper class for implementing tied hashes
cifs.idmap (8) - Userspace helper for mapping ids for Common Internet F...
cifs.upcall (8) - Userspace upcall helper for Common Internet File Syste...
cups-deviced (8) - cupsd helper programs
cups-driverd (8) - cupsd helper programs
cups-exec (8) - cupsd helper programs
cupsd-helper (8) - cupsd helper programs
deb-systemd-helper (1p) - subset of systemctl for machines not running systemd
debconf-escape (1) - helper when working with debconf's escape capability
debugedit (8) - Debuginfo editing helper
dpkg-maintscript-helper (1) - works around known dpkg limitations in maintain...
Dpkg::IPC (3) - helper functions for IPC
getcifsacl (1) - Userspace helper to display an ACL in a security descr...
gnome-help (1) - browse system documentation
helpztags (1) - generate the help tags file for directory
mkhomedir_helper (8) - Helper binary that creates home directories
pkttyagent (1) - Textual authentication helper
rstartd (1) - a sample implementation of a Remote Start rsh helper
run-with-aspell (1) - script to help use GNU Aspell as an ispell replacement
setcifsacl (1) - Userspace helper to alter an ACL in a security descrip...
ssh-keysign (8) - ssh helper program for host-based authentication
ssh-pkcs11-helper (8) - ssh-agent helper program for PKCS#11 support
unix_chkpwd (8) - Helper binary that verifies the password of the curren...
unix_update (8) - Helper binary that updates the password of a given user
xbrlapi (1) - X11 BrlAPI helper for Linux/Unix
-marta@marta-ubuntu:~$ man -k shell
add-shell (8) - add shells to the list of valid login shells
bash (1) - GNU Bourne-Again SHell
capsh (1) - capability shell wrapper
chroot (8) - run command or interactive shell with special root dir...
chsh (1) - change login shell
dash (1) - command interpreter (shell)
dbus-launch (1) - Utility to start a message bus from a shell script
dialog (1) - display dialog boxes from shell scripts
endusershell (3) - get permitted user shells
envsubst (1) - substitutes environment variables in shell format strings
flock (1) - manage locks from shell scripts
getusershell (3) - get permitted user shells
instmodsh (1) - A shell to examine installed modules
pam_shells (8) - PAM module to check for valid login shell
plainbox-qml-shell (1) - standalone qml-native shell
remove-shell (8) - remove shells from the list of valid login shells
setusershell (3) - get permitted user shells
sh (1) - command interpreter (shell)
sh.distrib (1) - command interpreter (shell)
shells (5) - pathnames of valid login shells
smbtar (1) - shell script for backing up SMB/CIFS shares directly t...
system (3) - execute a shell command
systemd-debug-generator (8) - Generator for enabling a runtime debug shell an...
tclsh (1) - Simple shell containing Tcl interpreter
tclsh8.6 (1) - Simple shell containing Tcl interpreter
unity (1) - wrapper for starting the unity shell and handling fall...
unity-panel-service (1) - program for drawing the panel with the unity shell.
whiptail (1) - display dialog boxes from shell scripts
wish (1) - Simple windowing shell
wish8.6 (1) - Simple windowing shell
wordexp (3) - perform word expansion like a posix-shell
wordfree (3) - perform word expansion like a posix-shell
** try - start another shell
- marta@marta-ubuntu:~$ wish
% exit
- marta@marta-ubuntu:~$ printenv
- marta@marta-ubuntu:~$ printenv | grep LS
-marta@marta-ubuntu:~$ whatis uname
uname (2) - get name and information about current kernel
uname (1) - print system information
-marta@marta-ubuntu:~$ whereis python
python: /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python3.5m-config /usr/bin/python3.5 /usr/bin/python3.5-config /usr/bin/python /usr/bin/python3.5m /usr/lib/python2.7 /usr/lib/python3.5 /etc/python3.4 /etc/python2.7 /etc/python3.5 /etc/python /usr/local/lib/python2.7 /usr/local/lib/python3.5 /usr/include/python2.7 /usr/include/python3.5 /usr/include/python3.5m /usr/share/python /usr/share/man/man1/python.1.gz
+from man man
SECTION directive in
/etc/manpath.config), and to show only the first page found, even if
page exists in several sections.
The table below shows the section numbers of the manual followed by the
types of pages they contain.
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g.
man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
Therefor, when referring to the man page of the passwd command, you will see it written
as passwd(1); when referring to the passwd file, you will see it written as passwd(5). The
screenshot explains how to open the man page in the correct section.
**Look and see the difference**
-marta@marta-ubuntu:~$ man passwd
-marta@marta-ubuntu:~$ man 5 passwd
-marta@marta-ubuntu:~$ man man
MAN(1) Manual pager utils MAN(1)
NAME
man - an interface to the on-line reference manuals
SYNOPSIS
man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L
locale] [-m system[,...]] [-M path] [-S list] [-e extension] [-i|-I]
[--regex|--wildcard] [--names-only] [-a] [-u] [--no-subpages] [-P
pager] [-r prompt] [-7] [-E encoding] [--no-hyphenation] [--no-justifi‐
cation] [-p string] [-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z]
[[section] page ...] ...
man -k [apropos options] regexp ...
man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...
man -f [whatis options] page ...
man -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L
locale] [-P pager] [-r prompt] [-7] [-E encoding] [-p string] [-t]
[-T[device]] [-H[browser]] [-X[dpi]] [-Z] file ...
man -w|-W [-C file] [-d] [-D] page ...
man -c [-C file] [-d] [-D] page ...
man [-?V]
DESCRIPTION
man is the system's manual pager. Each page argument given to man is
normally the name of a program, utility or function. The manual page
associated with each of these arguments is then found and displayed. A
section, if provided
-marta@marta-ubuntu:~$ pwd
/home/marta
-marta@marta-ubuntu:~$ pwd
/home/marta
-marta@marta-ubuntu:~$ cd /etc
-marta@marta-ubuntu:/etc$ pwd
/etc
-marta@marta-ubuntu:/etc$ cd $HOME
-marta@marta-ubuntu:~$ pwd
/home/marta
-marta@marta-ubuntu:~$ cd /usr
-marta@marta-ubuntu:/usr$ cd ~
-marta@marta-ubuntu:~$ pwd
/home/marta
-marta@marta-ubuntu:~$ pwd
/home/marta
-marta@marta-ubuntu:~$ cd /etc/vim
-marta@marta-ubuntu:/etc/vim$ cd ..
-marta@marta-ubuntu:/etc$ cd vim
-marta@marta-ubuntu:/etc/vim$ cd ../../home/marta
-marta@marta-ubuntu:~$ pwd
/home/marta
Look at backspaces for spaces in directory names.
-marta@marta-ubuntu:~$ cd IOS\ 655\ Python\ a\ Bash/
-marta@marta-ubuntu:~/IOS 655 Python a Bash$ ls
admin_manual.pdf
bash15.pdf
Biopython
book.programming_in_python_3.summerfield.pdf
-marta@marta-ubuntu:~/IOS 655 Python a Bash$ ls -l
total 103320
-rw-rw-r-- 1 marta marta 6975471 led 31 08:19 admin_manual.pdf
-rw-rw-r-- 1 marta marta 671790 říj 14 09:52 bash15.pdf
drwxrwxr-x 2 marta marta 4096 úno 13 12:25 Biopython
-marta@marta-ubuntu:~/IOS 655 Python a Bash$ ls -lh
total 101M
-rw-rw-r-- 1 marta marta 6,7M led 31 08:19 admin_manual.pdf
-rw-rw-r-- 1 marta marta 657K říj 14 09:52 bash15.pdf
drwxrwxr-x 2 marta marta 4,0K úno 13 12:25 Biopython
-marta@marta-ubuntu:~$ mkdir test_directory
-marta@marta-ubuntu:~$ ls -lh |grep test_directory
drwxrwxr-x 2 marta marta 4,0K úno 13 19:33 test_directory
-marta@marta-ubuntu:~$ ls -lh test_directory/
total 0
-marta@marta-ubuntu:~$ mkdir test_directory/subdirectory
-marta@marta-ubuntu:~$ ls test_directory/
subdirectory
-marta@marta-ubuntu:~$ mkdir -p test_directory/second_subdirectory/subsubdirectory
-marta@marta-ubuntu:~$ ls test_directory/second_subdirectory/
subsubdirectory
-rmdir test_directory/
rmdir: failed to remove 'test_directory/': Directory not empty
-rmdir -p test_directory/
marta@marta-ubuntu:~$ ls test_directory/
second_subdirectory
- Display your current directory.
- Change to the /etc directory.
- Now change to your home directory using only three key presses.
- Change to the /boot/grub directory using only eleven key presses.
- Go to the parent directory of the current directory.
- Go to the root directory.
- List the contents of the root directory.
- List a long listing of the root directory.
- Stay where you are, and list the contents of /etc.
- Stay where you are, and list the contents of /bin and /sbin.
- Stay where you are, and list the contents of ~.
- List all the files (including hidden files) in your home directory.
- List the files in /boot in a human readable format.
- Create a directory testdir in your home directory.
- Change to the /etc directory, stay here and create a directory newdir in your home
directory.
- Create in one command the directories ~/dir1/dir2/dir3 (dir3 is a subdirectory from dir2,
and dir2 is a subdirectory from dir1 ).
- Remove the directory testdir.
## working with files
-marta@marta-ubuntu:/$ pwd
/
-marta@marta-ubuntu:/$ cd ~
-marta@marta-ubuntu:~$ pwd
/home/marta
-marta@marta-ubuntu:~$ mkdir Madonna madona
-marta@marta-ubuntu:~$ ls | grep 'Ma\|ma'
madona
Madonna
marta.py
A directory is a special kind of file, but it is still a (case sensitive!) file. Each terminal window (for example `/dev/pts/4`), any hard disk or partition (for example `/dev/sdb1`) and any process are all represented somewhere in the file system as a file. It will become clear throughout this course that everything on Linux is a file.
Tells file type, never mind the end of file.
-marta@marta-ubuntu:~$ file m.txt marta.py unnamed.jpg
m.txt: ASCII text
marta.py: Python script, ASCII text executable
unnamed.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 530x941, frames 3
-marta@marta-ubuntu:~$ file /usr/share/file/magic
/usr/share/file/magic: directory
-marta@marta-ubuntu:~$ file /dev/sda
/dev/sda: block special (8/0)
-marta@marta-ubuntu:~$ file -s /dev/sda
/dev/sda: no read permission
-marta@marta-ubuntu:~$ sudo su
[sudo] password for marta:
-root@marta-ubuntu:/home/marta# file -s /dev/sda
/dev/sda: DOS/MBR boot sector
-root@marta-ubuntu:/home/marta# file -s /proc/cpuinfo
/proc/cpuinfo: ASCII text, with very long lines
-root@marta-ubuntu:/home/marta# exit
exit
marta@marta-ubuntu:~$
File creation
-marta@marta-ubuntu:~$ touch madonna
-marta@marta-ubuntu:~$ file madonna
madonna: empty
-touch -t 130207111630 Madonna
-marta@marta-ubuntu:~$ ls -l | grep "Mad\|mad"
rw-rw-r-- 1 marta marta 0 úno 13 21:11 madonna
rw-rw-r-- 1 marta marta 0 čec 11 1302 Madonna
When you no longer need a file, use rm to remove it. Unlike some graphical user interfaces, the command line in general does not have a waste bin or trash can to recover files. When you use rm to remove a file, the file is gone. Therefore, be careful when removing files! **confirmation flag -i** or use alias
-marta@marta-ubuntu:~$ alias rm="rm -i"
-marta@marta-ubuntu:~$ rm Mad* mad*
rm: remove regular empty file 'Madonna'? y
rm: remove regular empty file 'madonna'? y
To copy a file, use `cp` with a source and a target argument.
-marta@marta-ubuntu:~$ touch madonna
-marta@marta-ubuntu:~$ cp madonna Madonna
-marta@marta-ubuntu:~$ cd IOS\ 655\ Python\ a\ Bash/
-marta@marta-ubuntu:~/IOS 655 Python a Bash$ cp ../madonna .
-marta@marta-ubuntu:~/IOS 655 Python a Bash$ ls madonna
madonna
-marta@marta-ubuntu:~$ cp -r Pictures/ Pictures1
-marta@marta-ubuntu:~$ ls Pictures
Wallpapers
-marta@marta-ubuntu:~$ ls P*
Pictures:
Wallpapers
Pictures1:
Wallpapers
-marta@marta-ubuntu:~$ cp madonna Madonna Pictures1/
-marta@marta-ubuntu:~$ cp madonna Madonna ./Pictures1/
-marta@marta-ubuntu:~$ alias cp='cp -i'
-marta@marta-ubuntu:~$ cp madonna Madonna ./Pictures1/
cp: overwrite './Pictures1/madonna'? y
cp: overwrite './Pictures1/Madonna'? y
Use mv to rename or move to another directory. **Rename files or directories** - directory is with **d** Confirmation `mv -i`
-marta@marta-ubuntu:~$ ls -l
total 39452
drwxr-xr-x 2 marta marta 4096 pro 15 20:59 Desktop
drwxr-xr-x 2 marta marta 4096 pro 15 20:59 Documents
drwxr-xr-x 3 marta marta 4096 úno 13 15:39 Downloads
-rw-r--r-- 1 marta marta 8980 pro 15 20:48 examples.desktop
-rw-rw-r-- 1 marta marta 17860 led 29 15:25 Geocaching Akční filmy u Chlumčan
-marta@marta-ubuntu:~$ mv Pictures1 Pictures2
marta@marta-ubuntu:~$ rename 's/\.txt/\.png/' m*.txt
marta@marta-ubuntu:~$ ls m*
madonna marta.py mm.png m.png
marta@marta-ubuntu:~$ ls w*
w.txt ww.txt
-marta@marta-ubuntu:~$ touch a33.txt b33.png c43.txt d53.txt
-marta@marta-ubuntu:~$ rename 's/33/marta/' *.txt
-marta@marta-ubuntu:~$ ls *.txt *.png
amarta.txt b33.png c43.txt d53.txt mm.png m.png w.txt ww.txt
- List the files in the /bin directory
- Display the type of file of /bin/cat, /etc/passwd and /usr/bin/passwd.
- a. Download wolf.jpg and LinuxFun.pdf from [http://linux-training.be](http://linux-training.be)
-`*wget [http://linux-training.be/files/studentfiles/wolf.jpg](http://linux-training.be/files/studentfiles/wolf.jpg) ` -`*wget [http://linux-training.be/files/books/LinuxFun.pdf](http://linux-training.be/files/books/LinuxFun.pdf) ` -`*wget [http://linux-training.be/files/studentfiles/wolf.jpg](http://linux-training.be/files/studentfiles/wolf.jpg) ` -`*wget [http://linux-training.be/files/studentfiles/wolf.png](http://linux-training.be/files/studentfiles/wolf.png) ` -`*wget [http://linux-training.be/files/books/LinuxFun.pdf](http://linux-training.be/files/books/LinuxFun.pdf)`
- b. Display the type of file of wolf.jpg and LinuxFun.pdf
- c. Rename wolf.jpg to wolf.pdf (use mv).
- d. Display the type of file of wolf.pdf and LinuxFun.pdf.
- Create a directory ~/touched and enter it.
- Create the files today.txt and yesterday.txt in touched.
- Change the date on yesterday.txt to match yesterday’s date.
- Copy yesterday.txt to copy.yesterday.txt
- Rename copy.yesterday.txt to kim
- Create a directory called ~/testbackup and copy all files from ~/touched into it.
- Use one command to remove the directory ~/testbackup and all files into it.
- Create a directory ~/etcbackup and copy all *.conf files from /etc into it. Did you include all subdirectories of /etc ?
- Use rename to rename all *.conf files to *.backup .
For easier handling with files and directories, install **Krusader** ![Krusader for easy handling with files and directories](https://github.com/MartaVohnoutovaBukovec/IOS-655-Python-a-Bash/blob/master/krusader.png)
-marta@marta-ubuntu:~$ sudo apt-get install krusader
[sudo] password for marta:
Reading package lists... Done
Building dependency tree
Reading state information... Done
![Run Krusader](https://github.com/MartaVohnoutovaBukovec/IOS-655-Python-a-Bash/blob/master/run_krusader.png)
## Shell variables
-marta@marta-ubuntu:~$ echo This is the $SHELL shell
This is the /bin/bash shell
-marta@marta-ubuntu:~$ echo This is $SHELL on computer $HOSTNAME
This is /bin/bash on computer marta-ubuntu
-marta@marta-ubuntu:~$ echo My homedir is $HOME
My homedir is /home/marta
-marta@marta-ubuntu:~$ echo Hello $USER
Hello marta
-marta@marta-ubuntu:~$ echo Hello $user
Hello
-marta@marta-ubuntu:~$ MyVariable="Sandokan"
-marta@marta-ubuntu:~$ echo $MyVariable
Sandokan
-marta@marta-ubuntu:~$ unset MyVariable
-marta@marta-ubuntu:~$ echo $MyVariable
....
-marta@marta-ubuntu:~$ prompt PS1='> '
The program 'prompt' is currently not installed. You can install it by typing:
sudo apt install libmodglue1v5
-marta@marta-ubuntu:~$ sudo apt install libmodglue1v5
[sudo] password for marta:
Reading package lists... Done
Building dependency tree
Reading state information... Done
-marta@marta-ubuntu:~$ PS1='> '
-> PS1='\u@\h$ '
-marta@marta-ubuntu$
-marta@marta-ubuntu$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
-marta@marta-ubuntu$ PATH=$PATH:/usr/bin/python3.5
-marta@marta-ubuntu$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/bin/python3.5
`chmod options permissions filename`
4 stands for “read”, 2 stands for “write”, 1 stands for “execute”, and 0 stands for “no permission.” So 7 is the combination of permissions 4+2+1 (read, write, and execute), 5 is 4+0+1 (read, no write, and execute), and 4 is 4+0+0 (read, no write, and no execute). u=user g=group o=others
-marta@marta-ubuntu$ ls -l Mad* mad*
rwxr-xr-- 1 marta marta 0 úno 14 08:46 madonna
rwxr-xr-- 1 marta marta 0 úno 14 08:46 Madonna
-marta@marta-ubuntu$ marta@marta-ubuntu$ chmod u=rwx,g=x,o=rwx madonna
-marta@marta-ubuntu$: command not found
-marta@marta-ubuntu$ chmod u=rwx,g=x,o=rwx madonna
-marta@marta-ubuntu$ chmod 775 Madonna
-marta@marta-ubuntu$ ls -l Mad* mad*
rwx--xrwx 1 marta marta 0 úno 14 08:46 madonna
rwxrwxr-x 1 marta marta 0 úno 14 08:46 Madonna
Link to Python documentation and basics tutorial - https://docs.python.org/3.10/tutorial/index.html