Basics - Bash & File Systems
Open a terminal (with a Bash shell) by Ctrl+ALt+T
.
#
Bash SyntaxWatch the following video:
Keypoints of the video:
~
and$
- Bash syntax (command base): program-name arguments
- the search paths when executing:
- the
PATH
variable, - the absolute path, denoted with leading
/
, or - the relative path, the PWD (current working directory)
- the
Excercise: What is the different between executing
foo
and./foo
?
Excercise: How to pass multiple arguments when executing a program?
#
Bash Pipeline, Redirection and Built-in CommandsWatch the video until 11:30
Watch the video above from 11:30 First few built-in commands:
cd
change directoryecho
print arguments to stdout (tryecho $PATH
)export
set environment variable (inheritable variables)
#
Bash Basic Navigation and File ManipulationsAccess 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 FilesKeypoints of the video:
- Locate executable in PATH by
which
- Locate files using
find
orlocate
orwhereis
- using
grep
to find text in files (Reference)
#
Navigating through Directories and Locating Filestip
Other Learning Materials:
#
Questions for Thought- What is the difference between
ls
andls -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
which
whereis
andlocate
do? What are their differences?
#
Know More about a Filestat
to show the modification date etcfile
to know the binary type (architecture)ldd
to know the dynamic linkage (.so file links)
#
Uncompress Zip FileTar file:
tar -czvf archive.tar.gz /usr/local/something
Unzip file with permission preserved:
tar -xpf file