Linux Commands

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which command(s) below utilize globbing to expand wildcard characters into matching filenames?

  • echo
  • display
  • ls
  • bash (correct)

When using the rm command to remove directories, which options are required to recursively delete a directory and its contents?

  • -R (correct)
  • -r (correct)
  • -A
  • -D

In a long listing (ls -l), which character indicates that a file is a symbolic link?

  • -
  • d
  • c
  • | (correct)

What character precedes the name of hidden files and directories in Unix-like systems?

<p>. (C)</p> Signup and view all the answers

Which option for the ls command sorts the output by file size, from largest to smallest?

<p>-S (B)</p> Signup and view all the answers

Regarding file compression, is it accurate to say that gzip and bzip2 are different commands?

<p>False (A)</p> Signup and view all the answers

To achieve combined standard and error output redirection to a single file, which of the following is correct?

<p>&amp;&gt; (B)</p> Signup and view all the answers

Which command is designed to concatenate lines from two files based on their position in the file, rather than their content?

<p>paste (B)</p> Signup and view all the answers

Which command is used to display information about the Linux kernel?

<p>uname (C)</p> Signup and view all the answers

Which of the following command types can a command be in Linux?

<p>A program built-in to the shell, an alias, or a function (A)</p> Signup and view all the answers

Which of the following are valid command lines in Linux?

<p><code>Is -l /etc</code> and <code>Is /etc -l</code> (A)</p> Signup and view all the answers

In the cal [-smjy13] [[[day] month] year] command syntax, what does the [] characters around day indicate?

<p>Optional (A)</p> Signup and view all the answers

What does the syntax [-u|–utc|–universal] signify regarding command options?

<p>These three options mean the same thing (D)</p> Signup and view all the answers

To remove a variable from the current shell environment, which command would you use?

<p>unset (D)</p> Signup and view all the answers

How are local variables characterized in a Linux shell environment?

<p>Only available to the shell they are created in (C)</p> Signup and view all the answers

Which command correctly adds the /data directory to the existing $PATH variable?

<p><code>PATH=$PATH:/data</code> (D)</p> Signup and view all the answers

After modifying /data, what command ensures the changes are applied without a full unmount and remount?

<p><code>mount -o remount /data</code> (B)</p> Signup and view all the answers

What is the consequence when a user exceeds their block soft quota and the grace period expires?

<p>The soft limit becomes a hard limit until the user reduces usage below the soft limit. (B)</p> Signup and view all the answers

Which directories are commonly configured to allow any user to write files?

<p>/tmp and /var/tmp (D)</p> Signup and view all the answers

Which command activates a prepared swap space for system use?

<p>swapon (D)</p> Signup and view all the answers

Which command is specifically designed to back up and restore partition tables?

<p>sfdisk (B)</p> Signup and view all the answers

What command appends a physical volume to an existing volume group in LVM?

<p>vgextend (B)</p> Signup and view all the answers

When a partition fails to unmount, which utilities list processes using the filesystem, thus preventing unmounting?

<p>lsof and fuser (A)</p> Signup and view all the answers

Which commands display a list of currently mounted file systems and their mount points?

<p>mount and df (D)</p> Signup and view all the answers

Which two commands are used to examine and modify ext2/3/4 filesystems?

<p>tune2fs (B), dumpe2fs (C)</p> Signup and view all the answers

Which file does the fsck utility primarily consult to determine the filesystem type during a check?

<p>/etc/fstab (C)</p> Signup and view all the answers

Which command displays the location of backup superblocks for a given filesystem?

<p>dumpe2fs (D)</p> Signup and view all the answers

Given the output ls -l /etc/grub.conf -> ../boot/grub/grub.conf, which file is the soft link?

<p>/etc/grub.conf (B)</p> Signup and view all the answers

If five hard links point to the same inode, and four are deleted (including the original filename), what happens to the data?

<p>The data is still available from the remaining file (C)</p> Signup and view all the answers

Which directory is conventionally used as a temporary mount point for filesystems?

<p>/mnt (B)</p> Signup and view all the answers

After modifying the /etc/lilo.conf file, which command must be executed for the changes to take effect?

<p>lilo (C)</p> Signup and view all the answers

During the boot process, after the bootloader stage (LILO/GRUB), which phase is initiated?

<p>The kernel phase (C)</p> Signup and view all the answers

When configuring a new Linux system, which character is required at the beginning of an absolute file path?

<p>/ (C)</p> Signup and view all the answers

Which file, when placed in a user's home directory, is executed automatically when the user logs out of the system?

<p>~/.bash_logout (D)</p> Signup and view all the answers

After starting a terminal session, which command displays a list of processes running within that terminal?

<p>ps (C)</p> Signup and view all the answers

To modify a process's priority to a value lower than 0 using the renice command, which user privileges are required?

<p>The root user (B)</p> Signup and view all the answers

In Bash, which globbing character is used to match exactly one arbitrary character in a filename?

<p>? (C)</p> Signup and view all the answers

When the touch command is used on an existing file without any options, which file metadata is updated?

<p>Timestamp (A)</p> Signup and view all the answers

When using the find command, which option executes a specified command on each found file without prompting for confirmation?

<p>-exec (D)</p> Signup and view all the answers

Which of the following find command options enables a case-insensitive search when matching filenames?

<p>-iname (A)</p> Signup and view all the answers

In a Linux system, how do runlevels typically manage services during the boot process?

<p>The same set of services can be started or stopped at different runlevels, depending on the system's desired state. (D)</p> Signup and view all the answers

Which of the following statements best describes the role of /var/log/dmesg in the Linux boot process?

<p>It is overwritten at the end of each boot process, containing messages generated during the startup sequence. (D)</p> Signup and view all the answers

When examining system performance, the free command provides a summary of RAM and swap space usage. Which of the following metrics is NOT typically reported by the free command?

<p>CPU utilization. (D)</p> Signup and view all the answers

Coldplug devices are connected when the power is off. How does the system typically manage these devices upon startup?

<p>The system scans for new devices during the boot sequence and configures them as part of the hardware initialization. (B)</p> Signup and view all the answers

The command lspci is used to view information about network interface controllers connected on a PCI bus. What type of information would you expect to obtain about the NIC using this command?

<p>The vendor, device ID, and other hardware-level details of the NIC as identified on the PCI bus. (A)</p> Signup and view all the answers

Flashcards

uname command

Displays information about the Linux kernel.

What a Command Can Be

A program built into the shell, an alias or a function.

[] in command syntax

Optional arguments.

[-u|–utc|–universal] syntax

The options mean the same thing.

Signup and view all the flashcards

unset command

Removes a variable.

Signup and view all the flashcards

Local variables

Only available to the shell they are created in.

Signup and view all the flashcards

PATH=$PATH:/data

Adds /data to the existing PATH variable

Signup and view all the flashcards

ps -e

Displays all processes on the system.

Signup and view all the flashcards

What command performs globbing?

Bash performs globbing, which expands wildcard characters into matching filenames.

Signup and view all the flashcards

rm options to delete directories with files?

The -R (recursive) and -r (also recursive) options for rm allow deleting directories that contain files.

Signup and view all the flashcards

Symbolic link indicator in long listing

A | at the beginning of a long listing indicates a symbolic link.

Signup and view all the flashcards

Character for hidden files

Hidden files begin with a . (dot) character.

Signup and view all the flashcards

ls option to sort by size

The -S option to the ls command sorts output by size.

Signup and view all the flashcards

Command to merge files line by line

The paste command merges files line by line.

Signup and view all the flashcards

Example of a non-interactive editor

sed is a non-interactive editor, operating via commands rather than direct editing.

Signup and view all the flashcards

Command to display a file with line numbers

The nl command numbers the lines of a file.

Signup and view all the flashcards

Remounting '/data'

To remount '/data' after changes, use mount -o remount /data.

Signup and view all the flashcards

Exceeded Block Soft Quota

When a user exceeds their block soft quota and the grace period expires, the soft limit becomes a hard limit until usage is reduced.

Signup and view all the flashcards

World-Writable Directories

'/tmp' and '/var/tmp' are directories typically writable by all users.

Signup and view all the flashcards

Activate Swap Space

swapon activates a swap space after it has been initialized.

Signup and view all the flashcards

Backup/Restore Partition Table

sfdisk backs up and restores partition tables.

Signup and view all the flashcards

Add PV to VG

vgextend adds a physical volume to an existing volume group.

Signup and view all the flashcards

Find Processes Using Mount

lsof and fuser identify processes using a mounted partition.

Signup and view all the flashcards

List Mounted Filesystems

mount and df display a list of mounted file systems.

Signup and view all the flashcards

Filesystem Utilities

tune2fs and dumpe2fs

Signup and view all the flashcards

/etc/fstab

Determines filesystem type

Signup and view all the flashcards

dumpe2fs

Command to find backup superblock location

Signup and view all the flashcards

Soft link file

The actual file

Signup and view all the flashcards

Hard link deletion

The data remains accessible via the remaining hard link

Signup and view all the flashcards

/mnt

Used as a temporary mount point

Signup and view all the flashcards

lilo

Command to execute after modifying LILO

Signup and view all the flashcards

Third boot stage

The kernel phase

Signup and view all the flashcards

Absolute path character

The character that indicates an absolute path.

Signup and view all the flashcards

~/.bash_logout

The file executed when you log off the system.

Signup and view all the flashcards

ps command

Lists commands currently running in your terminal.

Signup and view all the flashcards

User to set priority below 0

Root user

Signup and view all the flashcards

Glob character: ?

Matches exactly one character.

Signup and view all the flashcards

touch command effect

Updates the file's timestamp.

Signup and view all the flashcards

find -exec option

Executes a command on each matching file.

Signup and view all the flashcards

find -iname option

Searches by name using a case-insensitive match.

Signup and view all the flashcards

Runlevels

Indicates that the same services can initiated/terminated at different runlevels.

Signup and view all the flashcards

Debian Default Runlevel

The default runlevel for Debian-based Linux systems is 2.

Signup and view all the flashcards

/var/log/dmesg

/var/log/dmesg is overwritten at the end of each boot process with the messages generated.

Signup and view all the flashcards

free command

The 'free' command displays a summary of RAM and swap space usage.

Signup and view all the flashcards

lspci command function

lspci command displays network interface controllers connected on the PCI bus.

Signup and view all the flashcards

Study Notes

  • The uname command displays information about the Linux kernel.

Commands

  • Valid command lines include Is -l /etc and Is /etc -l
  • To delete a variable, use the unset command.
  • To view all processes, execute ps -e.
  • To run a command in the background, type <command>&
  • Use killall to send a signal to a set of processes with the same name
  • echo ???a command displays only a file named ???a
  • The bash command performs globbing

rm Command

  • The -R and -r options for the rm command can be used to delete directories that contain files

Utilities

  • gzip and bzip are not aliases for the same utility
  • bzip2 does not support recursive compression

dd Command

  • The dd command can create large files that can be used as swap files
  • The dd command can copy entire partitions
  • stdout is the output stream of a command operating normally
  • Two or more commands combined with the | between them form a pipeline
  • Use 2>> to append a file with the normal output of a command
  • Use &> to send the normal and error output of a command to a single file

File Manipulation

  • The paste command merges two files together line by line
  • sed is a non-interactive editor
  • Use the nl command to display a file with its lines numbered
  • The sort command puts the lines of a file in alphabetical order
  • The pr command provides formatting options for printing a file

Regular Expressions

  • The . Matches any one character in regular expressions
  • The * Matches zero or more of the previous character in regular expressions
  • The regular expression a? is equivalent to a{0,1}
  • To use regular expression characters to match themselves, do not use the slash in front of the character

vi Command Mode Navigation

  • Press $ to navigate to the end of the line in vi command mode
  • Press b to move backward through a vi document, word by word
  • To save and then quit in vi command mode, type :wq
  • Press h or the left arrow key to move a character to the left in vi command mode
  • Press k or the up arrow key to move up a line in vi command mode

File Permissions

  • An octal permission mode of 750 corresponds to rwxr-x---
  • Only root can change the owner of a file
  • With rw-r--x permissions, both the user owner and group owners can view the contents of a file, assuming everyone has access to the directory the file is in
  • To switch to another group, you must be a member of the group you are switching to
  • chmod 0777 /data will remove all special permissions

Disk Quotas

  • userquota and grpquota are mount options used for disk quotas
  • The repquota command lists the users of groups and their quota statistics
  • mount -o remount /data will remount the /data filesystem using the option from the /etc/fstab file
  • If a user has exceeded the block soft quota and the grace period has expired, the soft limit becomes a hard limit until the user goes below the soft limit again

Directories with Writable Permissions

  • The /tmp and /var/tmp directories are typically writable to all users
  • Execute swapon to activate an initialized swap space

Partition Management

  • Use sfdisk to backup a partition table to a file and restore it later
  • Use vgextend to add a physical volume to an existing volume group
  • Use Isof and fuser to check what is keeping the partition busy
  • mount and df commands can display a list of mounted file systems
  • The first field in /etc/fstab specifies the device to mount
  • The sixth field in the /etc/fstab file is used to specify fsck order
  • mount -o loop cdrom.iso /mnt will mount an ISO file named cdrom.iso
  • The -S du command option shows a summary of the space used in a directory structure.
  • The number of inodes determines how many files can be stored in a filesystem.
  • tune2fs and dumpe2fs commands will display information about the Superblock
  • The fsck utility uses the /etc/fstab file to determine a filesystem type
  • dumpe2fs command will allow determining where the backup superblock is for a filesystem
  • The output of ls -l command includes the file /etc/grub.conf as the soft link file
  • If you have 5 hard linked files and you delete four of them, the data is still available from the remaining file
  • The /mnt directory is used as a temporary mount point
  • Use the lilo command needs to be executed after modifying the LILO configuration file
  • The boot is a directive is not typically used after a title directive in GRUB Legacy
  • The kernel phase is the third stage of the boot process
  • The bootloader loads the ramdisk into memory
  • The kernel is a component of memory
  • Runlevel 2 is used to define multi-user with no networking services

System Commands

  • The commands reboot and shutdown -r can be used to reboot the Linux system
  • The uname -s option to will display the kernel name

RPM Packages

  • An RPM command requires the full filename when querying the package
  • The package file requires the -p option to query
  • When using the -f option when performing an rpm query, the command will show the package that owns a file
  • rpm -U figlet-1.1-0.3.i686.rpm and rpm -i figlet-1.1-0.3.i686.rpm commands will install a RPM package file

Other Commands

  • The rpm2cpio command can extract files from a -.rpm file and list the content of a -.rpm file
  • The automatically searched directories for shared libraries are /usr/lib and /lib
  • The command apt-get purge will remove all files that belong to a Debian package
  • apt-get update command will update the list of available packages for APT
  • The dpkg -S command determines the Debian package that owns a file
  • dpkg –I can be used get a list of the installed Debian packages
  • The apt-cache show and dpkg -s commands will show detailed information about a Debian package

Linux Executables

  • Idd command is used to display the shared libraries of a dynamically linked executable
  • rpm -qKp command will check the integrity of an RPM file
  • The 1 special file man pages are typically located in section for Shell commands
  • The / character always starts with an absolute path
  • Place ~/.bash_logout in your home directory to be executed when you log off the system
  • The ps command lists the commands that are running in your terminal
  • You must log in as the root user in order to set a priority value lower than 0
  • Character ? exactly matches one character in glob
  • The touch command's default action on an existing file will update the file's timestamp

find Command

  • The -exec option will execute a command on each matching file without prompting in find command
  • The -iname option find command will search by name using a case-insensitive match
  • The command Is > /tmp/output.txt takes the standard output of Is and puts it into the /tmp/output.txt file
  • The -p option is used with the edquota command to copy the quota limits from one user account to another.
  • A dual boot system contains both Linux and a Microsoft Windows operating system
  • Most users home directories are found in /home.
  • Virtual memory is also referred to as swap memory.
  • The /var structure has directories which may have heavy activity for services like mail, ftp, httpd and printing

Additional Information

  • After running fdisk -cu /dev/sdb, the w fdisk command allows you to save changes and quit
  • Ivcreate is used to create a logical volume
  • The -m option to the tune2fs command changes the space reserved for system use
  • The -exclude option with the du command allows specifying a subdirectory to not include in the results
  • -f is the option to the fsck command forces a system check
  • The -t fsck command option specifies the filesystem type
  • The -b indicates soft link in the Is -I command
  • Soft links can be made to directories
  • Soft links can only be made to a file on another filesystem
  • The /boot directory stores the kernel
  • Full path to the LILO configuration file is /etc/lilo.conf

Encrypted Passwords

  • To use an encrypted password in the GRUB Legacy configuration file, use the -crypt option for the password directive
  • Primary configuration file for the GRUB 2 on a Fedora system is /boot/grub2/grub.cfg
  • The first process that the kernel launches is called the init process
  • The program that first starts the boot process is called the bootloader
  • Shared libraries make Programs smaller and use a more consistent base of code
  • The include Id.so.conf.d/*.conf contents are in the Idconfig configuration file by default
  • The libraries used by the /bin/Is command are displayed using Idd /bin/ls
  • It's false that the same set of services are started or stopped at different runlevels
  • The default runlevel for Debian based Linux systems is 2
  • bootup is not a Linux boot system
  • The /var/log/dmesg file is overwritten at the end of each boot process with the messages that were generated while booting
  • Use the command free to view the summary of the RAM and swap space
  • True, Coldplug devices are devices that are connected when the power is off
  • Ispci to view the network interface controller connected on the PCI bus
  • HALD is the abbreviation and stands for Hardware Abstraction Layer Daemon
  • HALD uses dbus to send notifications about any changes in the state of hardware devices

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Linux Command Line Basics
5 questions
1.11 – Linux - Linux Commands
67 questions
Use Quizgecko on...
Browser
Browser