Linux 2 Flashcards
What command lists files and directories in the current directory?
ls
This command is fundamental for viewing the contents of a directory.
What does the command ‘ls -l’ do?
Lists files with detailed info (permissions, owner, size, date)
This provides a more comprehensive view of files than ‘ls’.
What command lists all files, including hidden files?
ls -a
Hidden files are those starting with a dot (.) in Unix-like systems.
What is the function of the ‘cd’ command?
Changes the current working directory
This command is essential for navigation in the file system.
What does ‘pwd’ stand for and what does it do?
Prints the current working directory path
Useful for confirming your current location in the file system.
What command is used to create a new directory?
mkdir
This command allows users to organize files into folders.
What does the ‘rm’ command do?
Deletes a file
Use with caution as it permanently removes files.
What does ‘rm -r’ do?
Deletes a directory and its contents recursively
This command is powerful and can lead to data loss if misused.
What is the function of the ‘mv’ command?
Moves or renames files and directories
This command can be used to organize files effectively.
What command is used to copy files and directories?
cp
This is essential for backing up files or duplicating content.
What does the ‘cat’ command do?
Displays file contents or joins multiple files
Useful for quickly viewing text files.
What is ‘nano’?
A simple, user-friendly command-line text editor
Ideal for beginners who need to edit files.
What are ‘vim’ and ‘vi’?
Powerful command-line text editors with modes and shortcuts
They have a steeper learning curve but offer extensive features.
What does ‘chmod’ do?
Changes file or directory permissions
Important for controlling access to files.
What is the purpose of ‘chown’?
Changes the ownership of a file or directory
This is crucial for managing user permissions.
What does ‘sudo’ do?
Runs a command as the superuser (admin privileges)
Necessary for performing administrative tasks.
What is the function of ‘su’?
Switches to another user account (often root)
This command is used for changing user contexts.
What does ‘grep’ do?
Searches text using basic regular expressions
It is a powerful tool for finding specific patterns in files.
What does ‘fgrep’ or ‘grep -F’ do?
Searches for fixed strings (no regex interpretation)
Useful for exact string matches.
What is ‘egrep’ or ‘grep -E’ used for?
Searches using extended regular expressions
It allows for more complex search patterns.
What does ‘grep -f’ do?
Searches for patterns from a file
This allows for batch searching of multiple patterns.
What is the purpose of ‘grep -e’?
Allows specifying multiple patterns directly in the command
This enhances the flexibility of the search.
What does the ‘man’ command do?
Shows the manual page for a command
This is crucial for understanding command functionalities.
What does ‘man grep’ display?
The manual page specifically for grep
Useful for learning about grep’s options and usage.
What does ‘df -h’ show?
Shows disk space usage in human-readable format
Essential for monitoring available storage.
What does ‘du -sh’ do?
Shows the size of a directory and its contents
Useful for understanding space usage by specific directories.
What command displays network interface configuration?
ifconfig / ip
‘ip’ is preferred on modern systems.
What does the ‘history’ command do?
Displays a list of previously entered commands
Useful for recalling past commands and reusing them.
What is the Linux Directory Layout?
The structure of folders like /home, /etc, /bin, /var, /usr, etc.
Understanding this layout is key for navigating Linux systems.
What commands are used for Linux Directory Navigation?
Using commands like cd, pwd, ls
These commands facilitate moving through the file system.
What is the Least Privilege Principle?
Users should have only the minimum level of access needed to perform their tasks
This principle is essential for security.
What are Linux Distributions?
Different flavors of Linux (e.g., Ubuntu, CentOS, Fedora, Debian) built on the Linux kernel but with different tools, package managers, and goals
Each distribution caters to different user needs and environments.