Commands are similar in both Linux and macOS – Mac OS derived from BSD (Berkeley Software Distribution) Unix – This section is specific to Linux
Download a Live CD or install a virtual machine – Many pre-made Linux distributions are available
Use the man command for help - An online manual > man grep
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
Bash - ls
A
List directory contents – Similar to the dir command in Windows
Lists files, directories – May support color coding; – Blue is a directory, red is an archive file, etc.
For long output, pipe through more: > ls -l | more (use q or Ctrl-c to exit)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
Bash - pwd
A
Print Working Directory – Displays the current working directory path – Useful when changing directories often
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
Bash - mv
A
Move a file or rename a file
mv SOURCE DEST > mv first.txt second.txt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
Bash - cp
A
Copy a file - Duplicate files or directories
cp SOURCE DEST > cp first.txt second.txt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
Bash - rm
A
Remove files or directories - Deletes the files
Does not remove directories by default – Directories must be empty to be removed or must be removed with -r
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
Bash - chown
A
Change file owner and group - Modify file settings
sudo chown [OWNER:GROUP] file > sudo chown professor script.sh
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
Bash - su / sudo
A
Some commands require elevated rights
sudo – Execute a command as the super user or user ID – Only that command executes as the super user
su – Become super user or change to a different user – You continue to be that user until you exit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
Bash - chmod
A
Change mode of a file system object – r=read, w=write, x=execute – Can also use octal notation – Set for the file owner (u), the group(g), others(o), or all(a)
chmod mode FILE > chmod 744 script.sh
chmod 744 first.txt – User; read, write, execute – Group; read only – Other; read only
chmod a-w first.txt – All users, no writing to first.txt
chmod u+x script.sh – The owner of script.sh can execute the file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
Bash - apt-get
A
Advanced Packaging Tool – Handles the management of application packages – Applications and utilities