From Wikipedia:
A shell is a user interface for access to an operating system’s services.
The most basic shell is sh
.
bash
is the most common shell for Linux. It has many more features and is easier to use than sh
, and is nearly universal. There are other less common shells too, such as fish
(Friendly Interactive SHell) and zsh
.
bash features
*
represents a wild card.
Also know that .
represents the current working directory, while ..
represents the parent directory.
Some basic commands were listed in last week’s post. A more comprehensive guide can be found here: https://github.com/twlinux/club/wiki/Basic-UNIX-and-bash-commands.
Basic commands
-
echo Hello world!
-
ls DIR
displays the contents of the directoryDIR
. -
cd DIR
changes the current working directory toDIR
. -
mkdir DIR
creates a new directory. -
rmdir DIR
deletes an empty directory. -
rm FILE
deletes a file. -
touch FILE
creates a blank file calledFILE
. -
cat
concatenates the input stream and prints to the output stream. (?)-
cat FILE
prints the content ofFILE
-
cat > FILE
will write the standard input stream out toFILE
. End this command by pressing CTRL-D.
-
-
man COMMAND
shows the manual page forCOMMAND
. -
sudo COMMAND
runsCOMMAND
with superuser (root) privileges. -
apt
is a front-end to the Debian package manager.-
apt update
updates the package list. -
apt upgrade
updates the packages. -
apt install PACKAGE0, PACKAGE1...
installs the packages listed. Must be ran as root. -
apt remove [--purge] PACKAGE0, PACKAGE1...
uninstalls the packages. With the optional parameter--purge
, all configuration and data files are deleted as well. -
apt autoremove
removes all orphaned packages (unused dependencies). -
apt search KEYWORD
searches the repository forKEYWORD
.
-
Note: Every apt subcommand listed above excluding search must be run as root. sudo apt install...
CTRL-C
ususally cancels the foreground command by sending SIGINT
or a KeyboardInterrupt
.