Testout 1.5 Linux Basics
Displays a brief summary of how to use the command
--help
The shutdown command brings the system down or reboots the system in a secure manner. The syntax of the shutdown command is shutdown +m -h | -r message. The options for the shutdown command include: +m specifies when to preform the shutdown operation. The amount of time is specified in minutes -h instructs the system to shutdown and power down -r instructs the system to reboot after the shutdown -p powers off the machine message specifies a message that is sent to all users that accompanies the standard shutdown notification
Linux command shutdown and sub commands +m, -h, -r, -p, message
openSUSE, Fedora and Ubuntu
Name 3 popular Linux distributions
Command history: Each time you enter a command at the shell prompt, that command is saved Command completion: When you begin entering a command, you can press the TAB key, and the Linux shell will guess what you're trying to type and automatically complete the command for you.
What are two important features of Linux
superuser
What is Linux's equivalent to a windows administrator
Shell
What is a Linux CLI called
Distribution
What is a common version of Linux called
What would you enter at the command prompt to start a new Bourne-again shell (bash) session?
bash
Displays the contents of a text file on the screen. For example, to view the contents of the widget.txt file, you would enter widget.txt at the shell prompt
cat
Changes directories in the file system. For example, to change to the /home directory in the file system, you would enter cd /home at the shell prompt
cd
Copies files and directories from one location in the file system to another. For example, to copy the widget.odt file to the /home/rtracy directory, you would enter cp widget.ot /home/rtracy at the shell prompt To copy an entire directory structure include the -R option which specifies the contents be recursively copied.
cp and sub command -R
Displays the first few lines of a text file on the screen. For example, to view the first few lines of the widget.txt file you would enter head widget.txt at the shell prompt
head
Displays the IP address and the subnet mask assigned to this system
ifconfig
What would you enter at the command prompt on a Linux system to display the IP addresses and the subnet masks assigned to each network interface on a Linus system?
ifconfig
Displays more extensive documentation about the command. Use the Q key to go back to the shell prompt
info
Displays the contents of a text file on the screen, pausing the output one screen at a time. For example, to view the contents of the widget.txt file one page at a time, you would enter less widget.txt at the shell prompt
less
What would you enter at the command prompt on a Linux system to display a list of files and sub directories that exist within the present working directory?
ls
Displays a list of files and sub directory that exist within a directory. -a Displays all files, including hidden files -l Displays a detailed (long) listing of directory contents including ownership, permissions, modification dates, and file sizes -R Displays the contents of the directory as well as all of it's sub directories
ls and sub commands -a -l and -R
Displays the manual page for a command. It's very similar to the help screen, but it provides more detail. Use the Q key to quit and go back to the shell prompt.
man
You want to know more about the usage, command syntax, and the options available with the Linux ifconfig command. What would you enter at the command prompt to display this information about ifconfig?
man ifconfig
Moves files and directories from one location in the file system to another. For example, to move the widget.odt file to the /home/rtracy directory, you would enter mv widget.odt /home/rtracy at the shell prompt
mv
Displays the path of the current directory (Present Working Directory) on the screen
pwd
What would you enter at the command prompt on a Linux system to display the present working directory?
pwd
Deletes files and directories from the file system. For example, to delete the widget.odt file you would enter rm widget.odt at the shell prompt
rm
Allows you to switch user accounts
su
You are logged in as a user with limited system privileges, You are the Linux system administrator and you have the password to the root user account. When you need to switch to root user to perform administrative tasks, what command would you enter at the command prompt?
su -
Displays the last few lines of a text file on the screen. For example, to view the last lines of the widget.txt file, you would enter tail widget.txt at the shell prompt. The -f option can be used with tail to monitor a file for changes. If new content is added to the end of the file (such as a log file), the new lines will be displayed on the screen.
tail and sub command -f
Creates a new file
touch
Edits the content of a text file. The vi uses four different operating modes Command mode Command-line mode Insert mode Replace mode For example, to edit the contents of the widget.txt file, you would enter vi widget.txt at the shell prompt. You would then press the i key to enter insert mode and make the necessary changes to the file. When done editing the file, you would press the Esc key to enter Command mode. :wq saves and exits. They you would press the : key to enter command-line mode where you would enter exit to save your changes and exit the vi editor.
vi and sub commands i, Esc, : and :wq