- Background: Shell
- Varieties: C-shell, K-shell, Bash-shell (Bourne-again shell)
- Uses bash scripting language, which was added to make using Bash easier
- Allows you to add
if
statements, etc
Bash was a very early scripting language. Better to learn Perl or Python, which are easier to use.
- Can't log in as
root
. Ubuntu makes life hard. Runsudo su root
. fdisk -l
lists the contents of your drivestop
let's you see stuff but it's blocking. instead, useps aux
.|
is a way in CS to connect two processes in memory. changed way developers process completelystdin
is always keyboard,stdout
andsterr
are screen. The|
takesstdout
and connects to nextstdin
>
redirectsstdout
redirects to a file instead of screen.>
always overwrites and>>
appends.*
is a wildcard.rm test*
will remove any file that matches the wildcard pattern.?
stands for one character.
Everything in Unix is a file
/bin
: contains binary files (executables)/boot
: contains kernel. contains file with how the kernel was configured. you don't do much here./dev
: nothing to do here as administrator. stands for device. contains device files for all devices, including partitions (likesda1
). all devices are represented here. who creates files? old times, admins had to play with them. now, the kernel does this automatically by scanning harddrive and creating device file (when you plug in a USB it creates device file then removes it when you eject)/etc
: as administrator, most important directory. this directory contains configuration files. everything. this is where you do configuration./home
: place where normal users keep theirhome
directories./initrd.img -> /boot/initrd.img-3.16.0-4.dmg
:lib
: this is where the computer stores library files. as administrator, nothing to do here.lib64
: 64-bit version of libraries. as administrator, nothing to do here.lost+found
: forget the existence of this. it's a fake directory.media
: newer thanmnt
(in 2000s). this is an alternative mount point for drivers just to make it more user-friendly. when Ubuntu automatically mounts (and opens window) when you plug something in, this is the mount point.mnt
: mount. the mount point for all drivers. youcd
here to mount into drivers.opt
: optional. hand-in-hand withusr
. program files. if you install Apache, the main program files will be inusr
. some applications traditionally go toopt
and some go tousr
.proc
: if the kernel has a process running behind the scenes which controls things (info flow etc), it'll be inproc
. files are generated by the kernel. it's a virtual directory. when you open machine, it's created, and when you shut down, it disappears. full of technical info about memory/cpu/processes. the commandps aux
goes toproc
and displays info from there. for security, you can see when a process is trying to change name (virus). also more interesting is networking. you can see all the networking stuff there. directory is only there for information.root
: nothing more than thehome
directory of the root user. generally this should not be trashed with random files like docs or spreadsheets.run
:run
is not a traditional Unix directorysrv
: newervar
directory where some files are stored. never seen any distro make actual use of this directory. always put it invar
. may see it in the future.sys
: fake. doesn't exist.tmp
: two users. one wants to share with other. need a place where everyone has write access.tmp
is the only directory in the Unix system where everyone has write accessusr
: user. seeopt
var
: very useful. second most important directory. stands for various. here you find workings of servers. for example,var/log
is where logs live (var/logs/apache
, etc). it is traditional Unix.vmlinux -> boot/vmlinux-3.16.0-4-amd64
:sbin
: contains binary that only root can execute
- Different distros sometimes store certain files in different places, but if you know what you're looking for, you should be able to find it