Linux Command Line Made Easy A Practical - Craig Berg
Linux Command Line Made Easy A Practical - Craig Berg
Craig Berg
Introduction
Welcome to the Linux Command Line Guide For Beginners, and thank you
for choosing this book as your pass to the Linux world.
Please note that this book is for beginners at Linux, not power users.
Whether you are coming from a version of Windows or OSx or giving
Linux a try, this book will be invaluable to you.
However, while this book is indeed very beginner-friendly, it will not take
you from a novice to a Linux command Line master in one night.
That’s because the Linux Command Line is vast and challenging to master,
especially for beginners. Learning it requires a great deal of determination
and effort not because the Linux command line is complex or requires
genius-level IQ, but because it’s large and contains hundreds if not
thousands of commands.
In all honesty, we can dedicate a single chapter to one command and all its
arguments.
Nevertheless, the command line is a fundamental tool for Linux users. The
command line brings you every possible tool to work with in the ins and
outs of your operating system with just a keyboard. If you are skeptical
about this, follow the book, and you will realize real power.
The book has an efficient organizational structure:
1. The first chapter gives you the basics and must-know elements
of working with the Linux Command line.
2. In the second chapter, we shall look at Linux configuration and
where config files of applications are stored, and how to
manage them.
3. In the third chapter, we shall dive into the Linux tools and
common commands you will find yourself using most of the
time as you work with the command line.
4. Finally, we will conclude with a discussion on Linux
permissions, groups, and more.
In simple terms, Linux and Linux command line is amazing because it
opens many opportunities for you.
In this beginners’ book, we do not assume you have any programming
knowledge. That’s why the book will walk you through every step.
Read the book from start to finish because its structure is a lot like a
syllabus and less like a quick reference guide.
All you need is a computer and internet access for Linux installation—more
on that later. Once you have what you need, we can get started with the
installation and hands-on typing command lines, the fun part!
PS: I’d like your feedback. If you are happy with this book, please leave a
review on Amazon.
Please leave a review for this book on Amazon by visiting the page below:
https://amzn.to/2VMR5qr
Table of Content
Introduction
Section 1
Linux Installation
Guide
How to Choose A Linux Distribution
Installing Linux on Windows: Virtualization.
Installing Linux on Windows: Dual Boot
Installing Linux on Windows: WSL
Installing Linux on Mac OSx: Virtual Machine
Section 2
Linux Command, Terminal, and Shell
Linux Dictionary
The Command Line History
Simple Commands
Section 3
Navigating the Filesystem
The Current Working Directory
Tips and Notes about Linux Filesystem
ls Command Deep Dive
Section 4
Understanding the Filesystem
The less command
The Linux Filesystem
Section 5:
File and Directory Manipulation in Linux
Creating Directories – mkdir
Copying Files and Directories – cp Command
Moving, Renaming Files and Directories – mv command
Deleting Files and Directories – rm Command
Wildcards
Soft and Hard Links
Section 6
Commands for Working With Commands
Commands: Simple definition
Identifying Commands
Creating Custom Commands
Permissions
Owners, Groups, and Others
Read, Write, and Execute File Permissions
Changing File Modes – chmod command
Set Default Permissions – umask command
Sudo and su Users
Changing File Owners – chown command
Changing Users password – passwd command
Conclusion
Section 1
Linux Installation
Guide
The first thing we will do before diving into the command line is getting
your system setup. For Windows or PC users, you have three available
options that allow you to run Linux on any system running Microsoft office.
We will cover each option individually in the upcoming sections.
These available options for PC users include:
With the software setup, we can begin installing Ubuntu or your Linux
distribution.
In most cases, the distribution you choose will provide an installation guide.
Check the guide for your specific distribution.
Once you launch VirtualBox, you will get a window similar to the one
shown below:
Next, click on New, which will launch a box that requires you to provide
basic details about your Operating system. Enter the name of the
VirtualBox—feel free to provide any suitable name. In this case, we shall
name it Ubuntu.
Next, select the location in your filesystem where you want the Virtual
machine file stored. You can leave this as default. Next, choose the type
from the dropdown menu. If you provide a name for popular Operating
Systems, VirtualBox should detect the Type and Version. If this does not
happen, select the type as Linux and type as Ubuntu_64.
Select Debian for all Debian derivatives and Arch for Arch-based distros.
Next, select Expert mode, which will provide you with more options. Select
the amount of memory you want to allocate for your OS. We recommend
above 4GB unless you have less, in which case, you can allocate 1- 2GB.
Next, select create virtual disk now and click on create now:
Select the size and location storage for the virtual disk in the next windows
—leave this as default.
In hard disk file type, select VirtualBox Disk image and set as dynamically
allocated. That ensures the size of the hard disk increases as the system
needs more storage.
Click on create.
That should create a virtual machine that should be available in the list of
your virtual machines.
Now click on the Settings icon to launch the virtual machine’s settings, then
next, select the System option on the left side menu. That will give you all
the settings on the virtual system of your virtual machine. Under processor,
select the number of processors to allocate the machine.
Next, go to storage settings and select the Controller IDE. Under attributes,
click on the disk icon and select “Choose a disk file.” This will launch the
file explorer. Navigate to your download folder and select the Ubuntu iso
image we downloaded earlier.
Click on save and go back to the main menu. Select the start option to boot
up the virtual machine. During bootup, VirtualBox will prompt you to select
the startup disk. Select the Ubuntu iso we configured.
That will boot you up in the GRUB menu to select which option to use.
Select Ubuntu in the first option—as shown below.
If all configurations and settings are working properly, this should boot up
using the Ubuntu installer from the iso. Once in the installer menu, select
Install Ubuntu as we are running it on a virtual machine.
Continue with the installation options such as Language and Keyboard
Layout. Next, you can select either Normal installation, which comes
prepackaged with games and other utilities, or Minimal install, which only
contains basic system utilities.
Since we will work with the terminal, it’s best to choose the Minimal install
option.
You can enable or disable to install updates during the installation.
In the next section, select erase disk, and install Ubuntu. If you want to
customize disk allocation, choose advanced options.
As we are running a virtual machine that only affects the virtual disks, we
can use the entire disk for the installation.
Select install now, which will prompt you to confirm changes to the disk.
Go ahead and click yes and confirm.
Confirm your location and click on next. In the next step, enter your details
and set up your username and password, and click on continue.
Finally, click “install” to begin the installation process. Once the installation
is complete, you should boot into Ubuntu and start working with Linux.
Installing Linux on Windows: Dual Boot
Here, we are going to cover how to dual boot Windows alongside Ubuntu.
For this method, you will require a USB flash drive and free space on your
hard disk.
The first step—as usual—is to download the Ubuntu iso from the official
site. Next, we are going to download a tool to burn the iso on the flash
drive.
Open your browser, navigate to the resource page below, and download the
windows installer.
https://balena.io/etcher
Once you have acquired the installer, install and launch to begin the
process. Once you launch Balena, you will get a window that resembles the
one shown below:
In the window above, select the “Flash from File” option. Doing this will
prompt you to provide the location of the Ubuntu image we downloaded.
Next, Insert your Flash disk into your computer; BalenaEtcher should
automatically detect it.
If you have more than one device connected, choose the correct from the
Target menu. Once selected, click on Flash to begin the burning process.
NOTE: This will wipe your USB drive. Backup important data!
The next thing we are going to do is create a partition for our Linux
installation. On your Windows machine, Right-click the start menu and
launch the Disk management tool.
On the partition you want to create some space, right-click and select
Shrink Volume. Provide the amount of space to allocate to the partition; the
recommendation is more than 10GB of storage.
Once completed, reboot your machine and select your boot devices as the
USB device we created above.
NOTE: Check the web on how to select a boot device for your specific
machine.
This will boot Ubuntu and take you to the installation window. Follow the
process in the above section until you get to a point where the system
prompts you to select the installation type. Select install Alongside window
and click continue and complete the process.
Installing Linux on Windows: WSL
In a recent version of Windows, Microsoft has introduced a feature that
allows you to run Linux from within your system without a Hypervisor.
However, this feature is only available in the most recent version of
Windows 10. If you have earlier versions of Windows, consider using other
methods to run Linux.
For this to work, we need to enable the WSL feature. Open the start menu
and search for “Turn Windows features on or Off.” This will launch the
windows features window where we can turn on the WSL feature.
Click on Ok to apply the changes. This process may require you to reboot
your machine. Next, open Microsoft store and search for Ubuntu. Select
Ubuntu 20.04 LTS and click on install.
Once the WSL feature is enabled and Ubuntu installed, Launch the
application to start the installation. Provide a Linux username and password
to boot up the machine.
NOTE: WSL Installation does not provide a GUI interface, but since this
guide is about working with the terminal, this should not be a problem.
Installing Linux on Mac OSx: Virtual Machine
Because of this book’s scope, we shall not discuss a step-by-step process to
install Linux on a Virtual Machine on Mac. Check the Linux installation
process for Windows as they are similar.
Section 2
Linux Command, Terminal, and
Shell
Before we dive deep into executing Linux commands, let us first define a
few common terms in Linux.
Although these terms are basic, it’s good to get a good handle on their
meaning and differences:
Linux Dictionary
The most common Linux terms you need to know are:
Depending on the distribution you are using, you may get additional or
fewer directories than those shown above.
You may notice that once we navigate to a specific directory, the shell
prompt style changes appending the current path before the dollar sign.
For example, change directory to /usr/share using the command cd
/usr/share
ubuntu@VSALEM:/$ cd /usr/share
ubuntu@VSALEM:/usr/share$
2: Relative Pathnames
Relative pathnames are the other type of pathnames in Linux. Unlike
absolute pathnames where you start at the root directory, relative pathnames
start at the current working directory.
To achieve this, relative pathnames use special symbols to indicate relative
positions in the filesystem. These symbols include the dot (.) and the dot dot
(..)
The dot symbol represents the current working directory while the dot dot
symbol represents the working directory parent.
Let us see how it works.
In your terminal, navigate to /usr/share or any directory where you have
read permission.
ubuntu@VSALEM:~$ cd /usr/share/
ubuntu@VSALEM:/usr/share$ pwd
/usr/share
Suppose we want to go to the parent directory of share, which is /usr? We
can either use the absolute path and cd /usr or use the relative path by
entering the command cd ..
Now the question becomes, which should you use? The answer is the one
that requires less typing.
For example:
Let us assume you are in your /home folder. To go to /usr/share we can go
using cd /usr/share or cd ../../usr/share
NOTE: If you do not include the . (representing the current directory), the
shell automatically includes it
For example:
ubuntu@VSALEM:~$ cd /usr
ubuntu@VSALEM:/usr$ cd share
ubuntu@VSALEM:/usr/share$ cd ..
ubuntu@VSALEM:/usr$ cd ./share
ubuntu@VSALEM:/usr/share$
That means if the working directory is not specified, the shell automatically
assumes.
Tips and Notes about Linux Filesystem
Here’re some tips and pointers on working with the Linux filesystem:
1. Use the cd command to go back to your home directory in an
instance.
2. cd - - The cd command with the dash (-) argument takes you back
to the previous working directory.
3. cd ~ - Changes to the directory of the username specified.
4. Filenames in Linux are case sensitive. Thus, Directory and
directory are two different files.
5. Avoid using spaces while naming files and directories. Although
Linux does support spaces, use underscores, dots or dashes because
navigating directories with spaces is very hard. Here’s an example:
ubuntu@VSALEM:~$ cd This\ directory\ has\ spaces/
ubuntu@VSALEM:~$ cd This.Dir.Has.Spaces/
6. Linux contains hidden files that start with a dot (.). To view hidden
files and directories, use ls -a, which includes the hidden attribute.
Linux does
not contain or recognize the concept of file extensions. However, that does
not mean that if Linux does not, programs running in Linux don’t.
ls Command Deep Dive
As you continue to work with Linux, you will realize that ls is probably one
of the most used commands. That is perhaps for a good reason because it
provides you with the ability to view files and directories, their attributes
and permissions, and much more.
In this subsection, we shall delve deeper into the ls command and its
arguments and learn how to use them.
Up to now, we have covered how to list files and directories within our
current working directory.
Apart from the current directory, we can specify which directory to list
without moving into it.
For example:
From the above command, we can see the contents of the /usr/share
directory directly from the home directory.
You can also list more than one directory using a single command, shown
below:
The command above lists files and directories in both the home directory
(~) and /usr directory.
We can also pass some more arguments to the ls command to get more
details about the files and directories.
As you can see, the file listings order is now in reverse, listing them in an
alphabetical-descending order.
Do you remember what we mentioned about how a single command can
take up an entire chapter? The Ls is one of those commands.
Here, however, we shall not delve deep. Check out the ls manual to learn
more.
https://man7.org/linux/man-pages/man1/ls.1.html
Instead, we shall list some of the ls most common arguments, which
include:
In this case, the cp command copies all the specified files from the current
directory to the specified directory.
The cp command has a wide selection of options that you can use to
manipulate how and what the command does. Although we will not discuss
all of them, here are options worth mentioning.
1. -a or --archive – Using the cp command using the --archive
option allows you to copy files and directories with all their
respective attributes and permissions. Without the argument, the
copy command uses the permissions of the user carrying out the
copy command. For example, if the ubuntu user owned the copied
file, and root performed the copy, root owns the file. Be careful
with this.
2. -i or --interactive – The interactive argument enables the cp
command to prompt the user before overwriting a file. By default,
cp will automatically and silently overwrite a file.
3. -v or --verbose – As the name suggests, Verbose suggests shows
informative messages as each file and directory gets copied.
4. -r or --recursive – Allows the cp command to recursive copy files
and directories. This command gets plenty of use and is an almost-
must when copying directories.
5. -u or --update – The update argument is very effective. It tells the
cp command when copying files from one directory to another,
copy files that are newer than existing files in the destination
folder, or files that do not exist in the destination folder.
Moving, Renaming Files and Directories – mv command
The next command in the file operations section is the mv command. The
mv command moves or renames files depending on the syntax of the
command used.
Let us learn how to work with mv.
The first syntax for the mv command is similar to the cp command.
mv file1 file2
Using the syntax above, you move file1 into file2. If file2 exists, it gets
overwritten with the contents of file1. If it does not exist, the file2 gets
created, and file1 ceases to exist. That is the basic concept behind renaming
a file.
mv file1 file2…file(n) directory
When we use the syntax above, the mv command moves all the files
specified to the directory. For this to happen, the directory must exist.
Since mv and cp commands share a basic mode of operation, they share
similar options that include:
1. -i or --interactive – Will prompt the user before overwriting files.
2. -v or --verbose – Displays informative messages as the file
moving process continues.
3. -u or --update – Move files that do not exist or newer than existing
corresponding files.
Deleting Files and Directories – rm Command
The rm command deletes files and directories. The general syntax for the
command is:
rm file2 or directory1…file(n) or directory(n)
Depending on how and where you use the command, the rm command can
be very dangerous. Linux does not offer an undelete command, and once a
delete action occurs using the rm command, it is gone! Be careful when
working with rm .
The rm command also supports various arguments that include:
1. -f or --force – This option helps ignore nonexistent files and
arguments and never prompt
2. -i or --interactive – Prompts the user before deleting any existing
files. Cannot be used along with the --force argument.
3. -v or --verbose – Shows informative messages as the deletion
process gets carried out.
4. -r or --recursive – Recursively deletes files and directories. That
means if the specified directory contains subdirectories, remove
them as well.
We discuss wildcards shortly because they are helpful when working with
files and directories.
NOTE: You will often find a prank played on Linux beginners on the
internet telling you to execute the command cd / && sudo rm -rf *
As we continue, you will learn what the commands do but do not run the
command as this will break your entire system.
Wildcards
Now that we have covered file operation commands. Let us discuss a key
feature that makes these commands very powerful and better than using a
GUI file manager, although applicable to some file managers such as
Nautilus, Dolphin, or Caja .
The shell utilizes filenames intensively and provides a way to specify a
group of filenames in a single command. These are in the form of special
characters known as wildcards, also known as globbers.
Using wildcards, also known as globbing, allows you to select a group of
filenames based on patterns simultaneously. The following are common
wildcard supported on Linux systems.
1. * - The asterisk (*) wildcard finds and matches any characters
2. ? – Finds and matches any single character
3. [characters] – Finds and matches any characters that are members
of the set characters.
4. [! characters] – Finds and matches any characters that are not
members of the specified set.
5. [[:class]] – Finds and matches any characters that are members of
the set class. Commonly used character classes include:
Unfortunately, info seems taken, and we cannot use it. Let us try mshell :
That one is available to use. We use the alias command, followed by a
command or a sequence of commands we want to use.
For example, to navigate to the /etc directory, read the passwd file, navigate
back home, and finally list the directories, we can combine all the
commands in one line using a shell trick shown below:
cd /etc; less passwd; cd ~; ls -la;
Using alias , we can create a single command as shown below: The general
syntax for the alias command is:
alias name=’string’
Pay attention to the structure of the command below:
Immediately after the alias command, we pass the name and a string of
commands we want to substitute. Once a command has been defined using
the alias command, we can use it anywhere.
We can see our alias using the type command.
ubuntu@VSALEM:~$ type mshell
mshell is aliased to `cd /etc; less passwd; cd ~; ls -la;'
To remove an aliased command, use the unalias command as shown below.
ubuntu@VSALEM:~$ unalias mshell
ubuntu@VSALEM:~$ type mshell
-bash: type: mshell: not found
Granted, we avoided using an alias of an existing command because
sometimes it is appropriate to do so. For example, the command ls is an
alias of ls --color-auto . The following are some of the aliases defined in
the environment, use the alias command without arguments to find out
more.
Section 7
Permissions
One of the best features of Linux and other Unix-based systems is that they
are multitasking and multiuser. That means more than one user can use
systems simultaneously and run more than one process.
For example, a system attached to a network can have one user working on
it physically and others working remotely like SSH. Features such as the X
Window system allow remote users to run GUI applications remotely.
That is an amazing functionality built deep in the Linux kernel. However, to
implement this, users had to be protected from each other, preventing users
from interfering with files created by other users.
This chapter will look at how Linux implements protection measures like
identity, file permissions, file ownership, groups, etc.
Owners, Groups, and Others
Once in a while, when exploring the Linux file system, you will encounter
files that output the “Permission Denied” error when you try to read them.
An example of such a file is found in /etc/shadow
The main reason for this type of error results from user error. Meaning, if
you are running as a regular user, you may not have permission to read
some files.
Let us discuss how this works:
Linux uses what is we call the Unix Security model, which describes that a
user can own files and directories within a File system. If a user owns a
specific file or directory, he/she has full control over them. The user can
then belong to a group that consists of more than one user, all given access
to files and directories by their owners.
Besides providing access to the groups they belong to, a user or directory
owner can grant access rights to the world or everyone within the system.
You can find more information about your user identity by using the
command id .
ubuntu@VSALEM:~$ id
Let us dissect the output and see what it means (not all of it!)
When a user gets created, he/she gets assigned a unique value referred to as
a uid or unique id value, then mapped to the user’s username. The system
assigns the user a primary group id, also called a gid value. The group id
may also belong to other groups.
Depending on the system you run the id command on, you will get
different results. For example, a system like Fedora starts numbering
accounts from 500. On the other hand, Ubuntu starts at 1000.
A single user in Ubuntu can belong in more groups—shown above—
because of how the Ubuntu system handles system services and device
privileges.
system
devices and services.
This information gets derived from Linux text files. Accounts in Linux get
stored in /etc/passwd file, while groups get stored in /etc/groups file. Upon
creation of a Linux user account or group, each of these files gets modified.
A file such as /etc/shadow, used to store user passwords, also gets changed.
For every user account, the /etc/passwd file defines the
As discussed in previous chapters, the first letter in the first block (in this
case, a dash) indicates the file type. A – (dash) represents regular files, d
represents directories, l symbolic links, c represents a character-special
file, and b represents block devices files.
The rest nine blocks represent file modes that are read, write, and execute.
When a directory or file has r, w, or x attribute, certain effects get applied:
1. r – Grants read permission allowing the user and group to open
and read a file’s contents. If applied on a directory, a user can list
the directory’s contents only when the execute attribute is active.
2. w – Permits file writing or truncating; however, the write attribute
disallows file renaming and deletion. Deleting or renaming files
depends on attributes allocated to the parent directory. When you
set the execute attribute, the write attribute allows the creation,
deletion, and renaming of directory files.
3. x – Makes it possible to represent a file as an executable program
and executed. To make files written using scripting languages
executable, you must also set them as readable. On a directory, the
execute attribute makes it possible to enter a directory, e.g., cd
directory .
The following are examples of permission attributes set on files and
directories.
1. -rwx------ - Shows a regular file with read, write, and executable
permissions for the file owner only. No one else has either read,
write, execute permission to the file.
2. -rw------- - Also a regular file with read and write for the file
owner and no one else.
3. -rw-r--r-- - A regular file that has read and write for the file owner,
the owner’s group may also read the file and the world can read the
file too.
4. -rwxr-xr-x – Shows are regular file with read, write, and execute
permissions for the file owner, execute and read for the user’s
group and execute only for everyone else.
5. drwxrwx--- - Indicates a directory. The owner and user group
members may enter the directory, and create, rename and delete
files within the directory.
6. Lrwxrwxrwx – A symbolic link with placeholder permissions.
Placeholder permissions mean that the real permissions get
managed by the actual file referenced by the symbolic link.
Changing File Modes – chmod command
To change the permissions of a file or directory, we use the chmod
command.
Changing file permissions is only possible for file owners and superuser
accounts. Chmod supports two main ways to specify the permission
1. Octal notation
2. Symbolic notation
Symbolic Notation
Let us start with the symbolic representation of file permissions. Symbolic
notations have three main parts: who the change will affect, the operation
performed, and the permission set.
On who the changes will affect, letters such as u, g, o, and a are used. Here
are the meanings:
u – file owner
g – group owner
– Others or world
a – all; meaning the combination of user, group and world
If no character is specified, all is assumed, and changes apply to users,
groups, and the world.
The operation to be carried out gets specified in three main characters, i.e.,
+ (plus), – (minus), and = (equals). The plus indicates that you should add
permission. A minus indicates permission should be removed, and equals
means that only the specified permissions should apply with others
removed.
The permissions to be applied get specified in three letters, r (read), w
(write), and x (execute).
Here are some symbolic notation examples:
Octal Notation
Octal notation, as the name suggests, uses octal values to indicate wanted
permissions patterns. You can learn more about Octal (base 8) here:
https://www.tutorialspoint.com/octal-number-system
https://en.wikipedia.org/wiki/Octal#:~:text=The%20octal%20numeral%20s
ystem%2C%20or,for%20decimal%2074%20is%201001010 .
Because every octal number digit represents three binary digits, this plots
efficiently to the structure adopted when storing the file mode. The
following are the octal representations and their meaning.
We begin by cleaning any existing copies of the file using the rm -rf
myfile.txt command.
Next, we executed the umask command without any arguments to view the
current value that corresponds to a value 0022 (you will often find 0002
too), which is an octal notation of our mask.
Finally, we create a new instance of the file and look at the default
permissions.
Sudo and su Users
The su and sudo commands are very useful while working with Linux.
Let us start with su and discuss what it does.
The su command starts a new shell session as another user. The general
syntax for the command is:
su [-[l]] [user]
If you call the su command with the -l argument, the shell provides a login
shell for the specified user. That means the user’s environment gets loaded,
and the working directory changes to the user’s home dir. If the user to
login to is not specified, it defaults to the superuser or root account. It is
also possible to substitute the -l argument with –
For example, to log in as root, we use the command:
ubuntu@VSALEM:~$ su -
Password:
root@VSALEM:~#
The command above prompts for the root user account’s password, and if
correct, we login as the superuser account, indicated by the pound sign and
the username in the shell prompt. To exit from a shell session, we use the
exit command.
You can also run a single command as a superuser without having to log in
as root. For example:
Another way to execute commands as another user is by using the sudo
command. It is similar to su but provides a lot more functionalities.
The superuser can configure sudo account, allowing another user to execute
commands as other users (mostly the root user).
Sudo makes it possible to restrict some users to certain commands. For
example, a user working with networking and processes can operate under
restriction to these commands, allowing him to do that specifically without
interacting with other administrative commands.
Unlike su where a user requires a root account to log in into the shell, sudo
requires a user to provide an account’s password. However, the user should
be in the group known as sudoers to run commands as sudo .
Changing File Owners – chown command
To change the owner of a file or directory, we use the chown command.
Chown, however, requires superuser privileges either using su or sudo .
The general syntax for the command is:
chown [Option]... [Owner][:[Group]] File
Examples:
You may encounter systems that use the command chgrp to change the
group of a file.
Changing Users password – passwd command
The last concept in this chapter and book is how to change your password
and other users’ passwords using superuser privileges.
To change or set a password for a specific user account, we use the
command passwd .
The general syntax for the command is:
passwd [user ]
To change the password for the current user, simply enter the command
passwd without arguments, which will prompt you to enter a new
password.
Depending on the system, passwd may require you to use a strong
password and reject passwords that are too weak or similar to previously set
passwords. To change a password for another user, use the passwd
command with sudo or su .
Check manual pages for the command to learn more about the arguments
available.
Conclusion
When it comes to mastering the Linux command line, the only secret is
practicing, practicing, practicing some more, and learning hungrily.
This is only a beginner’s guide, meaning we left many advanced concepts
untouched—we have barely scratched the surface of what the Linux
command line can do.
Check out the /usr/bin directory to see for yourself.
PS: I’d like your feedback. If you are happy with this book, please leave a
review on Amazon.
Please leave a review for this book on Amazon by visiting the page below:
https://amzn.to/2VMR5qr