Linux Command Fundamentals Flashcards
What commands help explain the use of specific commands and their syntax?
command –help
man command
pinfo
What is the difference between su and sudo?
- su is used to open the shell as another user.
- sudo allows commands to be run in escalated mode.
What is the wheel group used for in RHEL?
The wheel group is used to assign a user root privlidges.
Users in this group can be seen in the group configuration.
$ cat /etc/group | grep wheel wheel:x:10:student
What is su - used for?
su - can be used to open a shell as another user
su - without any username will open as root (if enabled).
What is sudo used for?
sudo allows authorised users to run tasks with escalated privileges.
sudo ls -l /root
The user must be a member of the wheel group
What two types of options are often used with commands?
- Long options; these start with a – (double dash) e.g. –help
- Short options; these start with a - (single dash) e.g. ls -l and mkdir -p
What does the whoami command do?
The whoami prints the username associated with the current user.
What is the ls command used for?
The ls command lists directory contents.
What command line utility is used to administer network interfaces?
The ip utility is used to administer network interfaces.
What text user interace is used to administer network interfaces?
nmtui
What command is used to show addresses assigned to all network interfaces?
ip a (ip address)
What is the cat command used for?
The cat command is used to print files to the standard output.
Usage: cat /etc/hosts
What command line utility is used to list directory contents?
ls lists directory contents
What command is used to locate the current directory?
The pwd is used to print name of current/working directory.
What is the pwd command used for?
The pwd is used to print name of current/working directory.
What command is used to reset a password?
The passwd command is used to update a user’s authentication token(s).
What is the passwd command used for?
The passwd command is used to update a user’s authentication token(s).
What is the touch command useful for?
The touch command can be used to quickly create a file and to test if a user has permissions to modify a file e.g.
$ touch /etc/hosts $ touch: cannot touch '/etc/hosts': Permission denied
What command can be used to quickly verify if a user has permission to modify a file?
The touch command can be used to quickly create a file and to test if a user has permissions to modify a file e.g.
$ touch /etc/hosts $ touch: cannot touch '/etc/hosts': Permission denied
What commands can be used to view the manual page names and descriptions?
- apropos
- man -k
Example:
$ man -k directory $ adcli (8) - Tool for performing actions
man -k & apropos both search the mandb based on a keyword
What could cause man -k or apropos to return “nothing appropriate”?
The database searched by apropos is updated by the mandb program; this is updated periodicallly by a cron job and may require a manul execution on newly installed systems.
To manually update the mandb, execute the command with root privileges.
$ mandb
see man man (-k) or man apropos and man mandb
What ls command displays hidden files?
The ls -a command does not ignore entries starting with . (dot).
What is ls -d option useful for?
The ls -d option is used to see the properties of the directory and not its contents.
When using the ls utility, what is the -l option used for?
The ls -l command returns the results in the long listing format.