- 1. What is UNIX?
- 2. History of UNIX?
- 3. UNIX Architecture
- 4. Why use UNIX?
- 5. UNIX File system
- 6. Basic commands
- 7. process
- 8. Jobs
- 9. Packages
- 10. cut
- sort
- unique
- permissions
- head/tail
- vim text manipulation
-
Unix is on of the first widely-used operating systems.
-
Is the basis for many modern Operating systems.
-
Helped set a standard for the multi-tasking multi-user systems
-
1969 Ken Thompson, Dennis Ritchie start working on a file system, and name their system UNICS, which is later changed to UNIX.
-
1973 Thompson and Ritchie rewrote UNIX in C (while most of the operating systems at that time were written in assembly)
-
1991 Linux, GNU, and others: similar to UNIX, but their source code rewritten, very popular and widespread, free. (Many Linux Distributions: Ubuntu, Fedora, Debian, ...)
The part manages and controls the machine and takes care of scheduling of various computer Programs
A command interpreter that looks after the communication between the user and the system.
various utility Programs which performs a number of tasks (editing a file, sorting numbers or drawing a plot, .....)
-
Allows you to accomplish and automate complicated tasks that would usually require huge manual labor.
-
A rich set of small commands and utilities that can be combined in unlimited ways to perform complex custom tasks.
-
It is fun!
-
Not limited to pre-configured combinations or menus, as in personal computer systems.
-
Extremely useful computer skill that will be relevant many years from now.
-
the unix file system consists of one single global root directory that encapsulates everything of the machine. no matter how many disks or volumes are there.
-
Files and directories names are case sensitive.
-
The way to separate directories is with a forward slash "/".
-
Root : Main & parent Directory
-
/home: contains all the users and the user data and files
-
/dev : Access to hardware devices
-
/lib : Stores the libraries
-
/mnt : is used to mount disk drives
-
/usr : user installed Programs and files
-
/etc : system Settings
Command [opt1] [opt2]
-
print working directory (pwd):
-
Prints the full path of the current directory
-
Very handy when you get lost in the directories jungle
-
A useful variable for the strings
-
-
list (ls) [flags] <file> :
-
Lists the content of the current directory.
' - l ' => List a detailed file/folder information.
' - lh ' => List a detailed file/folder information.
' - a ' => list hidden files.
' - ls ' => sort files by size.
-
change directory (cd) <directory name>:
-
goes from the current directory to the specified one.
-
defaults to the home directory if not given a destination.
-
can take both absolute or relative paths.
relative: the location of a file or a folder that beginning at the current directory.
cd csc1101
absolute: the location of a file or a folder starting at (home directory)
cd /home/user1/csc1101
' ~ ' => Current user's home directory.
' . ' => The current directory.
' .. ' => The parent of the current directory.
' - ' => The previous directory.
-
-
Make a file (touch) [flag] <file>:
- creates a new file with the name
- Adjusts the timestamp of
-
Make Directory (mkdir) [flags] <directory> :
-
makes a new directory with the name
-
can use relative and absolute paths to make directories outside the current directory.
' - p ' => creates parent folders as well.
-
-
Remove File (rm) [flags] <file>
- removes the file called
- Using wildcards you can remove multiple files.
' - i ' => prompt before removal.
' - f ' => force remove.
' - r ' => recursively remove all files in a directory.
-
Remove Directory (rmdir) [flags] <directory>
- removes an empty directory <directory>.
- Throws error if the directory is not empty.
' - p ' => removes folder and its ancestors.
-
Copy (cp) [flags] <file> <destination>
-
copies from location to <destination>
-
to copy multiple files you can use wildcards (such as * )
-
-
Move (mv) [flags] <file> <destination>
-
Moves a file or directory from one place to another
-
Also used for renaming, just move from <oldname> to <newname>
-
-
File type (file) <file>
- will show you a description of the file’s contents.
-
Find File (find) <starting point> <type> <name>
- looks through any sub-directory to find a file
-
Locate File (locate) [flag] <name>
- similar to find
- no need to specify a starting directory (it searches the system)
' - n ' => limit the result to 20 entries.
' - c ' => count the number of results.
-
current user (whoami)
- prints the name of the current user.
-
(which)
- used to locate the executable file associated with the given command.
-
An instance of a running program.
-
More specific than a program
-
Each process is given a unique id (PID)
-
process screenshot (ps) [flags]
- Reports a snapshot of the current running processes, including PIDs
- Lists the processes created by the user in the current terminal
' - e ' => every process currently running.
' - u user' => processes created by this user.
-
Quick switching back and forth between processes makes it seem as though they are all running simultaneously.
-
Each process has a priority that can be set and changed by the user.
-
priorities range from -20(highest) to 19(lowest), if process is started with out a priority defaults to 0
-
nice process (nice) [flags] <command>
-
starts a process with the set priority.
-
if priority is not set default is 10
-
only root user can set priority below 0
' - n ' => priority.
-
-
renice process (renice) [flags] <PID>
-
changes the priority of a running process.
-
can change the processes created by this user only
-
only root user can set priority below 0
' - n ' => priority.
-
-
kill process (kill) <PID>
- Kills the process with this ID.
-
kill all processes (killall) [flag] <Process name>
- Kills all the processes of the current program.
' - TERM ' => Terminates execution (default).
' - HUP ' => Hang-up (restarts the program).
' - KILL ' => Like bleach, can kill anything.
- running processes (top)
- All in one stop for process management
' h ' => Help menu. ' Z ' => Set colors. ' k/K ' => Kill a Process. ' r ' => renice.
-
Check jobs (jobs)
-
Prints the current jobs with details and job id.
-
resume job (bg) <ID>
- Restart a stopped background process.
-
foreground (fg) <ID>
- Bring a background process to the foreground.
-
kill job (kill) %<ID>
- kills the job with the given id.
-
compress file (gzip) <file>
- can compress a single file.
- doesn't create a new compressed file
- compresses the file into a ".gz" archive.
-
decompress file (gunzip) <file>
- decompresses the file.
-
compress file (tar) cvf <file name> <source file>
-
compress as full directories.
-
creates a new copy that is compressed.
-
compresses the file into a ".tar" archive.
-
"c" => create
-
"v" => verbose / show progress
-
"f" => file name
-
-
decompress file (tar) xvf <file>
-
decompresses the file.
-
"x" => extract
-
"v" => verbose / show progress
-
"f" => file name
-
-
Debian package management (apt) [option]
- manages the packages on the device.
- "install" => installs a package
- "remove" => removes a package
- "show" => shows the details of a package
- Cut on delimiter__(cut) [flag] __
-
returns parth of the text.
- "c" => returns character
- "f" => returns a field
- "d" => change the delimiter to break on
-