Basics - Bash & File Systems
Open a terminal (with a Bash shell) by Ctrl+ALt+T.
Bash Syntax#
Watch the following video:
Keypoints of the video:
~and$- Bash syntax (command base): program-name arguments
- the search paths when executing:
- the
PATHvariable, - the absolute path, denoted with leading
/, or - the relative path, the PWD (current working directory)
- the
Excercise: What is the different between executing
fooand./foo?
Excercise: How to pass multiple arguments when executing a program?
Bash Pipeline, Redirection and Built-in Commands#
Watch the video until 11:30
Watch the video above from 11:30 First few built-in commands:
cdchange directoryechoprint arguments to stdout (tryecho $PATH)exportset environment variable (inheritable variables)
Bash Basic Navigation and File Manipulations#
Access and Navigation
Keypoints of the video:
- Understand command
cd,cd ..,ls,ls -a,mkdir,pwd - Understand command
touch,mv,rm
Creating & Editing Text Files
Keypoints of the video: - Understand command `cat`,`less`,`tail`, - Use `nano` to edit filesPrivileges and Permissions
Keypoints of the video: - Using `sudo` to raise to root access - Set permissions and group using `chmod` and `chown`Finding Documentation and Files#
Keypoints of the video:
- Locate executable in PATH by
which - Locate files using
findorlocateorwhereis - using
grepto find text in files (Reference)
Navigating through Directories and Locating Files#
tip
Other Learning Materials:
Questions for Thought#
- What is the difference between
lsandls -a? - How to differentiate between an absolute path and a relative path?
- What does environment variable PATH do? How to view, set, append environment variables?
- What can
whichwhereisandlocatedo? What are their differences?
Know More about a File#
statto show the modification date etcfileto know the binary type (architecture)lddto know the dynamic linkage (.so file links)
Uncompress Zip File#
Tar file:
tar -czvf archive.tar.gz /usr/local/something
Unzip file with permission preserved:
tar -xpf file