Introduction to Linux Commands and Concepts
23 Questions
1 Views

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

When the passwd command is executed without arguments, what action does the system initiate?

  • It prompts the current user to change their password. (correct)
  • It prompts the root user to set a new system-wide password policy.
  • It resets the password for all inactive user accounts.
  • It displays the password expiry date for all users on the system.

A system administrator needs to clear all current output from a user's terminal window. Which command is the most efficient to achieve this?

  • `refresh`
  • `reset`
  • `cls`
  • `clear` (correct)

In a UNIX/Linux environment, what is the primary responsibility of the kernel?

  • Managing user authentication and permissions.
  • Handling network communication protocols.
  • Allocating resources and managing hardware. (correct)
  • Providing a command-line interface for users.

A user wants to re-run a command they executed five commands ago. Which command-line editing feature is most suited for this task?

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

An IT technician needs to remotely access a legacy system to perform maintenance. Which command is suitable for establishing a remote terminal session, though less secure than its alternatives?

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

Which of the following statements accurately distinguishes between peer-to-peer and server-based networks?

<p>Server-based networks rely on centralized resource management, while peer-to-peer networks do not. (B)</p> Signup and view all the answers

A system administrator needs to modify permissions such that the owner has read, write, and execute permissions, the group has read and execute permissions, and others have no permissions. Which chmod command achieves this?

<p><code>chmod 750 file</code> (A)</p> Signup and view all the answers

A user navigates to a directory and then enters the command cd ... What action does this command perform?

<p>Moves to the parent directory. (A)</p> Signup and view all the answers

What is the outcome of running the command find /var -name "*.log"?

<p>It seeks '.log' files inside the <code>/var</code> directory and all its subdirectories. (B)</p> Signup and view all the answers

If umask is set to 027, what are the default permissions for newly created files?

<p>rw-r----x (A)</p> Signup and view all the answers

Which command is used to modify the group ownership of a directory?

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

What is the correct way to save and exit a file in vi editor?

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

In the vi editor, what is the function of the command :1,$s/old/new/g?

<p>Substitutes all occurrences of 'old' with 'new' throughout the entire file. (B)</p> Signup and view all the answers

How can you display the last 20 lines of a file named 'example.txt'?

<p>tail -n 20 example.txt (B)</p> Signup and view all the answers

You need to find all lines in a file that contain either 'error' or 'warning'. Which grep command accomplishes this?

<p>grep -e 'error' -e 'warning' file.txt (C)</p> Signup and view all the answers

What is the function of the following sed command: sed 's/pattern//g' file.txt?

<p>Deletes every occurence of 'pattern' from file.txt (A)</p> Signup and view all the answers

What is the primary function of the cut command in Linux?

<p>To extract specific columns or fields from a file or input (C)</p> Signup and view all the answers

What is the correct command to count the number of lines in a file named 'data.txt'?

<p>wc -l data.txt (C)</p> Signup and view all the answers

What is the purpose of the pipe operator (|) in Linux?

<p>To pass the output of one command as input to another. (C)</p> Signup and view all the answers

Before using the uniq command to remove duplicate lines from a file, what must you do first?

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

When using the diff command, what does it primarily display?

<p>The modifications needed to make two files identical. (B)</p> Signup and view all the answers

Given two unsorted files, file1.txt and file2.txt, which command will print only the lines that are unique to file1.txt?

<p>comm -23 file1.txt file2.txt (A)</p> Signup and view all the answers

Which of the following best describes the relationship between SAN and LAN?

<p><code>SAN</code> is a specialized network for connecting storage devices, while a <code>LAN</code> connects general computing devices. (C)</p> Signup and view all the answers

Flashcards

passwd command (no arguments)

Prompts the current user to change their password.

Bash shell

The default shell for most Linux distributions, combining features of Korn and Bourne shells.

clear command

Clears all current output in the terminal window.

Kernel's role

Allocates resources and manages hardware in UNIX/Linux.

Signup and view all the flashcards

Command history

Allows you to execute a previously used command.

Signup and view all the flashcards

telnet command

To establish a remote terminal session.

Signup and view all the flashcards

SSH vs. Telnet security

SSH encrypts communications, whereas Telnet does not.

Signup and view all the flashcards

mount command

Connect a directory to the root hierarchy.

Signup and view all the flashcards

chmod 750

Grants read, write, and execute permissions to the owner; read and execute to the group; no access for others.

Signup and view all the flashcards

ls -a

Lists all files, including hidden ones, in a directory.

Signup and view all the flashcards

/var directory

Stores log files and variable data that changes during system operation.

Signup and view all the flashcards

find /home -name ".txt"

Searches for files named '.txt' within the /home directory and all its subdirectories.

Signup and view all the flashcards

umask command

Sets the default permissions for newly created files and directories.

Signup and view all the flashcards

/dev directory

Contains special files that represent hardware devices and virtual devices.

Signup and view all the flashcards

.(dot)

Refers to the current working directory.

Signup and view all the flashcards

chown command

Changes the ownership of a file or directory.

Signup and view all the flashcards

chmod 700 file

Protects a file so only the owner has read, write, and execute permissions.

Signup and view all the flashcards

Inodes

Tracks metadata about files, such as permissions, ownership, and data block locations.

Signup and view all the flashcards

pwd command

Displays the full path of the current working directory.

Signup and view all the flashcards

ls -l command

Displays detailed information about files and directories, including permissions, size, owner, and modification date.

Signup and view all the flashcards

Sort command

Arranges lines of text alphabetically or numerically.

Signup and view all the flashcards

wc command

Counts the number of lines, words, and characters in a file.

Signup and view all the flashcards

Head command

Displays the first few lines of a file (default is 10 lines).

Signup and view all the flashcards

Study Notes

  • The passwd command, without arguments, prompts the current user to change their password.
  • The Bash shell, a default for most Linux distributions, incorporates features from both the Korn and Bourne shells.
  • The clear command is optimal for clearing the terminal window's current output.
  • The kernel in UNIX/Linux allocates resources and manages hardware.
  • Command history allows you to execute a previously used command.
  • The primary purpose of telnet is to establish a remote terminal session.
  • Server-based networks rely on centralized resource management, unlike peer-to-peer networks.
  • The X Window system provides a graphical user interface in UNIX/Linux.
  • The command date -u outputs UTC time and date
  • In "GNU/Linux," GNU stands for "GNU's Not Unix."
  • The layered structure of UNIX/Linux protects hardware by restricting access to the kernel, allows simultaneous use of multiple shells, and reduces the need for use authentication.
  • The shell interprets user commands in UNIX/Linux.
  • The man -K option allows keyword searches across all man pages.
  • The /etc/passwd file contains user account information.
  • SSH is more secure than Telnet because it encrypts communications.
  • Modern Linux distributions support usernames up to 32 characters long.
  • Multi User capability allows multiple users to access the same resource simultaneously.
  • The command cal -m displays the current month's calendar with Monday as the first day of the week.
  • A user can change their current shell by typing the desired shell's name.
  • The command who am idisplays the user account logged in on the terminal.
  • The /mnt directory is commonly used for mounting temporary file systems.
  • The command unlink removes an empty directory.
  • The /proc directory contains information about running processes.
  • The mount command connects a directory to the root hierarchy.
  • The command cd .. moves to the parent directory.
  • UNIX/Linux uses a tree-based hierarchical file system structure.
  • The command chmod 750 file grants read, write, and execute permissions to the owner, read and execute to the group, and no access for others.
  • Hidden files in a directory are listed using ls -a.
  • The /var directory typically stores log files and variable data.
  • The command find /home -name ".txt" searches for .txt files in /home and its subdirectories.
  • The umask command sets default permissions for new files.
  • The /dev directory contains device files.
  • The dot (.) signifies the current directory in file system navigation.
  • The command chown changes a directory's ownership.
  • chmod 700 file protects a file from being modified or deleted by anyone except the owner.
  • /documents is NOT part of the standard Linux directory hierarchy
  • The /etc directory is used for system-wide configuration files.
  • Inodes in a Linux file system track file permissions and data.
  • The command pwd displays the present working directory path.
  • The command ls -l displays files in long format with detailed information.

Vi/Nano/Emacs Editor Commands

  • The dd command in vi deletes a single line.
  • In vi, u undoes the last command.
  • In vi, /error searches for the word "error".
  • The command :%s/foo/bar/g in vi replaces "foo" with "bar" globally.
  • In nano, Ctrl+o saves the current file.
  • To start inserting text in vi, enter insert mode.
  • To move the cursor to the end of a line in vi, use $.
  • To quit vi without saving changes, use :q!.
  • In nano, Ctrl+k cuts the current line.
  • In Emacs, Ctrl+s searches for a specific string.
  • The command :wq saves and exits a file in vi.
  • To switch from insert mode back to command mode in vi, press Esc.
  • In vi, yw yanks (copies) a single word.
  • To delete from the current position to the end of the line in vi, use D.
  • In nano, Ctrl+w searches for a string.

File Manipulation Commands

  • The sort command arranges lines in alphabetical or numerical order.
  • The cut command extracts specific columns from a file.
  • The join command merges two files based on a common field.
  • The wc command counts the number of lines, words, and characters in a file.
  • To display the first 10 lines of a file, use head.
  • The -i option for grep ignores case sensitivity.
  • The uniq command removes duplicate lines in a file.
  • The tail command displays the last few lines of a file.
  • The cat command concatenates files and displays the output.
  • The diff command displays the differences between two files.
  • The -F option in awk specifies a field delimiter.
  • To count the number of lines in a file, use wc -l.
  • The sed command s/$/text/ appends text to the end of a line.
  • cut -f1,3 extracts fields 1 and 3 from each line of a file.
  • The paste command combines the content of two files line by line.

Piping and Special Characters

  • The pipe operator | passes the output of one command as input to another.
  • The grep command searches for a specific pattern in a file.
  • The uniq command requires a sorted input file to work properly.
  • The -n option in grep displays line numbers of matches.
  • The tr command translates or deletes characters in a file.
  • The sed command s/error/fixed/ replaces the word "error" with "fixed".
  • The wc -w command displays the number of words in a file.
  • The pr command is used to format file output into columns.
  • The diff command displays the differences between two files line by line.
  • The paste command combines two files horizontally (side by side).
  • The comm command displays output in three columns: unique to file 1, unique to file 2, and common lines.
  • The comm -3 command prints only the unique lines between two files.
  • The awk '{print $2, $4}' command prints the 2nd and 4th fields of a file.
  • The sed '5d' command deletes line 5 from a file.
  • cut -d: -f2 extracts the second field from a file using : as the delimiter.

Acronyms

  • ROM: Read-Only Memory
  • EPROM: Erasable Programmable Read-Only Memory
  • EEPROM: Electrically Erasable Programmable Read-Only Memory
  • I/O: Input/Output
  • SAN: Storage-Area Network
  • HPC: High-Performance Computing
  • DLM: Distributed Lock Manager
  • VMM: Virtual Machine Manager
  • VM: Virtual Machine
  • TCP/IP: Transmission Control Protocol/Internet Protocol
  • LAN: Local Area Network
  • WAN: Wide Area Network
  • MAN: Metropolitan Area Network
  • PAN: Personal Area Network
  • NEO: Network Operating System
  • VoIP: Voice over IP
  • SaaS: Software as a Service
  • PaaS: Platform as a Service
  • IaaS: Infrastructure as a Service
  • DRM: Digital Rights Management
  • FSF: Free Software Foundation
  • GPL: GNU Public License
  • UI: User Interface
  • CLI: Command-Line Interface
  • GUI: Graphical User Interface
  • API: Application Programming Interface
  • MS-DOS: Microsoft Disk Operating System
  • GRUB: GRand Unified Bootloader
  • PCB: Process Control Block
  • PID: Process Identifier
  • IPC: Interprocess Communication
  • UDP: User Datagram Protocol
  • MIDL: Microsoft Interface Definition Language
  • XDR: External Data Representation
  • NC: Network Computer
  • PDA: Personal Digital Assistant
  • ALU: Arithmetic Logic Unit
  • HDD: Hard-Disk Drive
  • NVM: Nonvolatile Memory
  • NVS: Nonvolatile Storage
  • DMA: Direct Memory Access
  • SMP: Symmetric Multiprocessing
  • SID: Security ID
  • FIFO: First In First Out
  • EC2: Elastic Compute Cloud
  • ASICs: Application-Specific Integrated Circuits

Studying That Suits You

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

Quiz Team

Description

Explore essential Linux commands like passwd, clear, and date. Understand the Bash shell, kernel functions, command history, and telnet. Learn about network models and the role of the X Window system in providing a GUI.

More Like This

Bash Shell Grundlagen
10 questions

Bash Shell Grundlagen

AdoringClavichord avatar
AdoringClavichord
Chapter 8: Working with Directories
16 questions
Bash Scripting 3
40 questions

Bash Scripting 3

RevolutionaryFern2779 avatar
RevolutionaryFern2779
Comandos y Atajos de Linux
16 questions

Comandos y Atajos de Linux

HandierCatSEye1468 avatar
HandierCatSEye1468
Use Quizgecko on...
Browser
Browser