Book Notes: The Linux Command Line - Chapter 5
About this Book 📚
Name: The Linux Command Line
Author: William E. Shotts
Publisher: No Starch Press
Cover:
Translation Version:
Notes ✍️
4 Types of Commands
- An executable program
- All files we saw in
/usr/bin
are executable programs. Within this category, programs can be compiled binaries such as programs written in C and C++, or programs written in scripting languages such as the shell, Perl, Python, Ruby, and so on.
- All files we saw in
- A built-in command
- A command built into the shell itself.
bash
supports a number of commands internally called shell builtins. Thecd
command, for example, is a shell builtin.
- A command built into the shell itself.
- A shell function
- Shell functions are miniature shell scripts incorporated into the environment.
- An alias
- Aliases are commands that we can define by ourselves, built from other commands.
Commands of Chapter 5
type
- Display information about command type
- Examples
type ls
type cd
type mv
which
- Display an Executeable’s Location
- Examples
which ls
which cp
help
- Display information about built-in commands
- Examples
help cd
--help
- Display a description of the command’s supported syntax and options
- Examples
mkdir --help
mv --help
man
- Display a program’s mannual page
- Examples
man mv
whatis
- Display one-line manual page descriptions
whatis mv
whatis cp
- Display one-line manual page descriptions
alias
- Create an alias for a command
- 🍉 PS: The
alias
commands disappear when shell session ends, but we will learn how to store them for future use in later chapters.
Lab 🧑🏻💻
Why Labs ?
Lab provides a hands-on learning experience that allows us to apply theoretical knowledge to practical situations. This helps us to better understand concepts and retain information more effectively.
Lab1
use
type
,which
,help
,whatis
,man
to check fundamental commands
pwd
cd
ls
mkdir
cp
mv
rm
less
file
Lab2
Prerequisites
Try using
;
to write commands in 1 line
cd; cd Desktop;
Task
Use
alias
to change current directory toDesktop
type cdd # check if 'cdd' is used
alias cdd='cd; cd Desktop;' # if not, assgin these command lines to 'cdd'
cdd # use this command