Topic 6A Identify Features of Linux
What does the acronym "GNU" stand for, and what is its significance in the context of Linux?
"GNU is Not Unix" -recursive acronym highlighting open source nature of the GNU software components that can be used with Linux
What are the correct redirection operators to (a) overwrite the destination file and (b) append data to the destination file when using the 'cat' command?
(a) To overwrite any data at the destination file, use the '>' operator: cat > file. (b) To append the 'cat' data to the destination file, use the '>>' operator: cat >> file. **
What is the purpose of arguments in a Linux command?
- arguments are values supplied to the cmd for it to operate on such as file names ** arguments must be supplied in the correct order for the cmd syntax
Describe the role of a teletype (tty) device in the context of terminals and shells.
- connect the terminal and shell and handles text I/O **tty device manages the flow of text between the terminal and the shell
What is Xorg and what role does it play in a Linux Desktop environment?
- is an open source version of the X window Display system -drives the graphical environment in a Linux Desktop **Xorg is responsible for managing the display input devices and windowing system in Linux desktop
What is a process ID (PID), and why is it important in a Linux system?
-A process ID (PID) is a unique non-negative integer assigned to a process when it is started on a Linux system -identify and manage individual processes -PID 1 is assigned to the init daemon, which is the first process to start on the system and acts as the parent of all other processes -Subsequent processes receive higher available numbers as their PIDs -allow for process management, such as monitoring, killing, or otherwise controlling the behavior of individual processes
What does the grep command stand for, and what is its primary function?
-Globally search a Regular Expression and Print. -primary function is to search and filter the contents of files, displaying lines that contain a match for the search string ** -powerful search tool in linux cmd -search for simple text(literals) -search for complex patterns using regular expressions (regex) -locating relevant information
Name four examples of desktop programs or environments that can be launched within X.
-Gnome (GNU Object Model Environment), KDE (K Desktop Environment), Cinnamon, and Xfce. ** different desktop environments that can be launched within Xorg each offer unique features
How does the boot process of a Linux distro without a desktop environment differ from one with a desktop environment?
-Linux distro without desktop boot process launches into terminal interface connected to default shell command interpreter -a distro with a desktop loads a GUI at startup
What is a Linux distribution (distro)?
-The Linux Kernel plus a distinctive type of package manager and software repository with a selection of customizable shells, utilities, and applications along with community supported or commercial licensing and support options ** Linux distributions package together various components to create a complete operating system tailored for different use cases and target audiences. Examples include Ubuntu, Fedora, and Debian
What is the advantage of using the sudo command over the su command?
-The main advantage of using the sudo command over the su command is that the root password does not have to be shared among multiple administrators. -The sudo command allows any user listed in the /etc/sudoers file to run specified commands with superuser privileges without requiring the root password
How can you copy multiple files with a specific pattern using the cp command?
-To copy multiple files with a specific pattern using the cp command, use an asterisk (*) as a wildcard in the source file pattern ** Copy all files beginning with the name message from the /var/log directory into /home/david. The -v option displays the files copied: cp -v /var/log/message* /home/david
What is the main difference between using 'su' and 'su -' in Linux?
-Using 'su' without an option retains the original user's profile and variables and keeps you in the original user's home directory -using 'su -' switches to the root user account and launches a new shell under the context of the root user, which is considered a better practice
What is the primary advantage of console switching in a Linux system?
-ability to access multiple login sessions and shells simultaneously without needing to log out or close current session **allows users to multitask, switch between accounts or work with different shells in parallel
What is the difference between apt-get and apt, and how are they used for updating and installing software?
-apt-get is an older command interface for APT -apt command is a newer, preferred command tool for interacting with APT. ** Both apt-get and apt use identical sub-commands for basic operations such as updating and installing software **used to managepackages in Debian based Linux distros
What is a metacharacter in the context of Linux shell expressions, and why might you need to escape them?
-character that has a special meaning when interpreted by the shell in an expression You might need to escape them to treat them as literal characters rather than their special meaning. ** For example, the asterisk (*) is used to match any number of any characters. However, if you want to search for text containing an asterisk character itself, you must escape it to prevent the shell from interpreting it as a metacharacter.
In a Linux command, what is the first "word" interpreted as?
-first word is cmd **
What is the difference between interactive and non-interactive use of a shell?
-interactive use refers to working at a terminal issuing commands directly to shell -non interactive means the shell reads commands from a script file
What does the ps command do in Linux, and how can it be used with options?
-invokes the process table, a record that summarizes the currently running processes on a system -is run without any option, it displays the processes run by the current shell with details such as the PID, the terminal or pseudoterminal associated with the process, the accumulated CPU time, and the command that started the process **different options may be used along with the command to filter the displayed fields or processes.
top command
-lists all processes running on a Linux system -process management tool by enabling you to prioritize, sort, or terminate processes interactively -displays a dynamic process status, reflecting real-time changes ** command keys offer different sorting and filtering options
How can a user change their effective group ID on Linux?
-newgrp cmd -allows user to switch to a different group and update their effective group ID ** A user can belong to many groups but can only have one effective group ID at any one time
how are options(switches) used in a Linux command
-options are used to change the operation of a cmd ++option can be single letter with a "-" before it or a word with "--" before it. the order in which the options are placed on the cmd is not important
What does the 'pwd' command do in Linux?
-prints the working directory. ** 'pwd' stands for "print working directory," -it displays the current working directory in the terminal. -The working directory is important because any commands that don't specify a path as an argument will default to the working directory.
What is the primary purpose of a desktop environment in a Linux distribution?
-provide GUI for users to interact with the OS and apps **desktop environment offers a more visually accessible and user friendly interface compared to the command line
What are the three types of permissions in the Linux file system?
-read(r) : view contents of a file or directory -Write(w) : modify or delete object -Execute(x): run executable file or script
What is the purpose of the pipe symbol ( | ) in a Linux command?
-send or redirect the results of one cmd to another cmd ** placing the pipe symbol between two cmds you can use the output of the first cmd as the input for the second cmd *** creating a "pipeline" so cmds can process the data sequentially
What is a terminal emulator, and how does it connect to a shell within a desktop environment?
-software app that allows users to access command shell within a desktop environment -runs within a window on the desktop and connect to the shell via pseudoterminal interface **terminal emulators replicate the functionality of a command line terminal within a desktop environment **Psudot (pty/pts) interface enables comms between the terminal emulator and the shell
What is the starting point of the Linux unified file system?
-starting point of Linux unified file system is the root, represented by / ** directories and subdirectories are created from the root to store files **
In Linux, what is the difference between the running configuration and the persistent configuration for network management?
-the running configuration is the current, active configuration of the network interfaces -the persistent configuration is the one applied after a reboot or after a network adapter is reinitialized. The persistent configuration ensures that the desired network settings persist across reboots or network adapter resets.
Where are user and group settings stored in Linux?
-user settings are stored in the /etc/passwd file, and group settings are stored in the /etc/group file -User passwords are typically stored as encrypted hashes in the /etc/shadow file, along with other password settings like age and expiration date
Why is antivirus software still important for Linux systems despite the perception of reduced risk compared to Windows systems?
-while the OS's design and distribution diversity make it harder for viruses to infect every Linux system, it is not entirely risk-free -should be assessed for security controls based on their specific use -Linux-based web servers, in particular, should have appropriate security controls in place -Linux anti-malware software can detect infected files and prevent the transmission of malware to Windows-based systems via email or file transfer
What is the purpose of a software repository in a Linux distribution, and how does it ensure the integrity of the packages?
A software repository in a Linux distribution stores precompiled software packages deemed appropriate by the vendor or sponsor, including any updates -It ensures the integrity of the packages by generating a cryptographic hash of the compiled package using functions such as MD5, SHA-256, or GNU Privacy Guard (GPG) signing -The hash value and function are published on the package vendor's site, and the package manager validates the hash or signature before proceeding with an update or installation.
How can a superuser change the owner of a file or directory, and which command can the file owner use to change the group?
A superuser can change the owner of a file or directory using the chown command. The file owner can change the group using the chgrp command ** Regular users cannot use this command, even if they own the file chgrp command can be used by the file owner to change the group associated with the file
What are the two common package managers used by different Linux distributions, and which package formats do they work with?
Advanced Packaging Tool (APT) APT is used by Debian distributions and works with .deb format package Yellowdog Updater Modified (YUM) while YUM is used by Red Hat distributions and works with .rpm format packages ** Package managers are tools that help in the installation, management, and removal of software packages in a Linux distribution
Different keystrokes within top command
ENTER Refresh the status of all processes. SHIFT+N Sort processes in the decreasing order of their PID. M Sort processes by memory usage. P Sort processes by CPU usage. u Display processes belonging to the user specified at the prompt. q Exit the process list.
Single quotes (' ') perform strong escaping
Everything within single quotes is treated as a literal character. For example, '$(pwd) * example one' results in the expression: $(pwd) * example one
The backslash () escapes only the next character
For example, \* treats * as a literal character; \\ treats \ as a literal character.
How do you show line numbers in vi or vim?
In command mode, enter ':set number' to show line numbers. ** display line numbers in the vi or vim editor, making it easier to navigate and edit the file
Can anyone change the permissions of a file or directory using the chmod command?
No, only the owner of the file or directory can change permissions using the chmod command.
What are some of the notable shell programs available for use with Linux?
Notable shell programs for Linux include Bash, zsh, and ksh (Korn shell) ** These shells provide a command environment for users to operate the OS and applications. They have the same core command set but differ in features such as command history, tab completion, command spelling correction, and syntax highlighting
What is the difference between symbolic notation and numeric (octal) notation for permissions?
Numeric (octal) notation, on the other hand, represents permissions using octal values: 0 for no permissions, 4 for read, 2 for write, and 1 for execute
How do you switch from insert mode back to command mode in vi or vim?
Press the ESC key to switch from insert mode back to command mode
yum check-update
Refresh the local database with information about the packages available from the repository:
How do you switch to insert mode in vi or vim, and what are some command keys to do so?
Some command keys include 'i' (switches to insert mode at the current cursor position), 'a' (appends text after the current cursor position), 'A' (appends text at the end of the current line), and 'o' (inserts text on a new line below the current line).
What does the 'ls' command do in Linux, and what are the -l and -a options used for?
The 'ls' command lists the contents of a directory -l option providing a detailed (long) list -a option displaying all files, including hidden or system files. **'ls' is similar to the 'dir' command in Windows
What key combination can be used to switch between virtual tty consoles on a Linux system?
The CTRL+ALT+Fx key combination
In a Linux system with a graphical environment installed, which virtual tty console does the X server typically occupy?
The X server typically occupies tty1. **When a Linux system boots up with a graphical environment, the X server takes over one of the virtual tty consoles, usually tty1, to display the graphical interface
What is the basic syntax for the find command in Linux?
The basic syntax is find path expression , where path is the directory in which to start the search and expression is the data to match ** Understanding the path and expression components will help you craft accurate searches for files and directories.
What are the commands for managing user accounts in Linux?
The commands for managing user accounts in Linux are useradd, usermod userdel passwd. These commands can be used to add, modify, and delete user information and change the user's password
What is the purpose of the cp command in Linux?
The cp command in Linux is used to create a copy of files either in the same or different directory with the same or different name
How is the first fixed disk and a second storage device represented in the Linux file system?
The first fixed disk is represented as /dev/sda, and the second storage device is represented as /dev/sdb. ** devices are represented as files under the /dev directory. second storage device (like a USB drive) would be represented as /dev/sdb
What is the main purpose of the ip command in Linux?
The ip command is used for managing network interfaces and routing on modern Linux systems.
drwxr-xr-x 2 bobby admins Desktop -rwx-r-x r-- 1 bobby admins scan.sh
The leading character designates the file type. For example, - represents a regular file and d indicates a directory. The permissions for the Desktop directory show that the owner ( bobby ) has full ( rwx ) permissions, whereas the group ( admins ) and others have read and execute but not write ( r-x ). For the scan.sh file, the user has read/write/execute ( rwx ) permission, the group has read and execute permission ( r-x ), and world has read permission only ( r-- )
What is the primary purpose of a shell in a Linux operating system?
The primary purpose of a shell is to provide a command environment by which a user can operate the OS and applications. **A shell allows users to issue commands, execute scripts, and interact with the operating system and applications through a text-based interface.
What is the purpose of the su command in Linux?
The su (switch user) command in Linux is used to switch from the current user account to another user account, including the root (superuser) account, by specifying the username.
What are the three ways to escape strings in Linux shell expressions, and how do they differ?
The three ways to escape strings in Linux shell expressions are using a backslash (), single quotes (' '), and double quotes (" ")
In vi or vim, what are the two modes, and how do you switch between them?
The two modes in vi or vim are command mode and insert mode. ** Command mode is used for file operations, such as writing changes and closing the editor. Insert mode is used for entering and editing text.
What are the two notations used with the chmod command to modify permissions?
The two notations used with the chmod command to modify permissions are symbolic notation and octal notation
How can you open or create a file using the Nano text editor?
To open or create a file, use 'nano filepath' or 'nano -l filepath' to show line numbers. ** preferred by those coming from a Windows environment. You can use the cursor keys to move around the text, and editor and file operations are completed using CTRL + key shortcuts
How do you save and quit in vi or vim?
Use ':wq' from command mode to save and quit. ** The ':wq' command saves the changes made to the file and then closes the editor. Alternatively, you can use ':q!' to quit without saving.
What happens during the Linux boot process concerning the system kernel, virtual file system, and the persistent root partition?
When Linux boots, a system kernel and virtual file system are loaded to a RAM drive. The unified file system identifies the location of the persistent root partition from the appropriate storage device and loads the file system stored on the disk. **During the boot process, the Linux kernel is loaded into memory, along with a virtual file system. This virtual file system is responsible for locating the persistent root partition on the storage device and loading the file system from the disk. This ensures that the operating system can access the necessary files and directories from the storage device.
Can each virtual tty console support a different login prompt and shell?
Yes, each virtual tty console can support a different login prompt and shell. **The virtual tty consoles provide separate environments for multiple users to log in and interact with the system simultaneously
Are commands, parameters, and file and directory names case sensitive in Linux?
Yes, they are case sensitive in Linux ** For example, 'ls -l file.data' and 'ls -L File.data' would produce completely different results. Using capitals in the command name would generate an error message.
How can you access help for a specific Linux command?
You can access help by using the --help option or the man command. ** --help option will display its function and syntax, while using 'man command_name' will display the help pages for a particular command.
How can grep be used in conjunction with other commands to filter their output?
You can pipe the output of other commands to grep to apply different types of filters. ** -Piping the output of one command to grep allows users to filter and refine the results further based on specific criteria
How can you search for files with specific permissions using the find command?
You can use the -perm option followed by the permission set (in octal notation) to search for files with specific permissions. For example: find /path/to/directory -perm 755
How can you use the find command to search for directories only?
You can use the -type option followed by 'd' to search for directories only. For example: find /path/to/directory -type d
How can you search for files owned by a specific user using the find command?
You can use the -user option followed by the username to search for files owned by a specific user. For example: find /path/to/directory -user username ** can also search for -name, -size or -perm
How can you use TAB completion and command history in a terminal emulator?
You can use the TAB key for completion and the UP and DOWN arrow keys to scroll through command history.
if you want to search for files with a specific name using the find command, which option should you use?
You should use the -name option followed by the filename pattern to search for files with a specific name. For example: find /path/to/directory -name "filename.ext"
To install a new application
apt-get install PackageName (for apt-get) apt install PackageName (for apt)
To refresh the local database with information about the packages available from the repository
apt-get update (for apt-get) apt update (for apt)
To update all packages with the latest versions
apt-get upgrade (for apt-get) apt upgrade (for apt)
yum is the command interface for YUM
basic commands are used to update/patch and install software.
How can you view the permissions of a file or directory in Linux?
by running the command ls -l, which provides a long directory listing. The output will show the permissions for each object in symbolic notation (e.g., drwxr-xr-x).
What is the purpose of the rm command in Linux?
can be used to delete files. It can also be used with the -r option to delete directories **Use the -r switch with caution, and remember that Linux commands operate without confirmation prompts. There is no opportunity to cancel.
How can you display the contents of a file named 'file.txt' with line numbers using the 'cat' command?
cat -n file.txt ** The 'cat' command is used to display the contents of a file The -n option adds line numbers to the output. So, by running 'cat -n file.txt,' you can display the contents of 'file.txt' with line numbers.
How do you change the working directory to a subdirectory called 'documents' using the 'cd' command?
cd documents ** 'cd' stands for "change directory."
How do you copy a file from one directory to another using the cp command?
copy a file from one directory to another using the cp command, use the following syntax: cp source_file destination_directory ** Copy the file hosts from the directory /etc into the directory /tmp, keeping the file name the same: cp /etc/hosts /tmp
Double quotes ( " " ) performs weak escaping
escapes metacharacters but expands variables and allows a feature called command substitution. For example, "$(pwd) * example one" expands to use the output of the pwd command: \home\david * example one
What are the commands for managing group memberships in Linux?
groupadd- add groupmod- modify groupdel- delete
How can you convert numeric (octal) permissions to symbolic notation?
identify the octal values for the owner, group, and others. For example, 0754 represents 7 for the owner, 5 for the group, and 4 for others. Then, convert each octal value to its corresponding symbolic notation: 7 (rwx), 5 (r-x), and 4 (r--). The resulting symbolic notation is rwxr-xr--.
f you want to search for files containing the word "audit" in a long directory listing, you can use the command
ls -l | grep audit. The ls -l command generates a long directory listing, and then grep filters the results, displaying only the lines containing the word "audit."
Move and rename the file alarm.dat in the current directory to alarm.bak in /tmp
mv alarm.dat /tmp/alarm.bak
What is the difference between the cp and mv commands in Linux?
mv command is used to either move files from one directory to another or rename a file. ** The cp command makes a copy of a file, leaving the original file intact, whereas the mv command moves the file to a new location or renames it, effectively changing the original file
How do you move a file from one directory to another using the mv command?
mv command, use the following syntax: mv source_file destination_directory **EX Move the file data.txt from the /home/david directory to the /tmp directory, keeping the file name the same: mv /home/david/data.txt /tmp
How can you issue multiple commands on a single line in a Linux command line interface?
placing a semicolon ( ; ) between the commands.
Redirection operators
redirection operators can be used to control how the output of a command is written to a file. The '>' operator is used to overwrite the destination file with the command output, while the '>>' operator appends the command output to the destination file without removing any existing data.
Remove the contents of the entire directory tree underneath the folder /home/david/data:
rm -r /home/david/data
Remove all files ending in .bak from the /var/log directory:
rm /var/log/*.bak
Remove the single file data.old from the current working directory
rm data.old
What is a kernel?
software component that provides the core set of operating system functions. These include features for managing system hardware and for communicating between software and hardware
What does the Linux file system hierarchy standard (FHS) specify?
specifies how directories under root should be named and where types of files should be placed ** provides guidelines for the structure and organization of the file system in Linux **example /home directory contains user specific data while the /etc directory stores config files
What are the differences between stdin, stdout, and stderr in the context of a terminal?
stdin (0) handles user keyboard input, stdout (1) displays data generated by the shell stderr (2) carries error information **manages the I/O of text within a terminal connecting the shell and terminal via teletype device
What is the purpose of the PATH environment variable in the Linux command interface?
stores a list of directories that the shell searches for executables when a command is entered. **when cmd is entered in Linux the looks for an executable file related to the cmd. The PATH variable contains a list of folders where the shell searches for the cmd(if found it will be executed)
How do you rename a file using the mv command?
use the following syntax: mv old_file_name new_file_name * Rename the file app1.dat in the /var/log folder to app1.old: mv /var/log/app1.dat /var/log/app1.old
What is the purpose of the chmod command in Linux?
used to secure files and directories by modifying their permissions using either symbolic or octal notation **In Linux, each file and directory has a set of permissions that determine the level of access for different users. The chmod command allows the owner of a file or directory to change these permissions, thus securing the files and directories according to their requirements
Install a new application:
yum install PackageName
Update all packages with the latest versions:
yum update