linux Flashcards
What command displays the current working directory?
The command pwd
displays the current working directory.
How do you list all files, including hidden files, in a directory?
The ls -a
command lists all files, including hidden ones.
How can you view the contents of a file one screen at a time?
Use the less
or more
command to view file contents one screen at a time.
What command is used to change file permissions?
The chmod
command changes file permissions.
How do you change ownership of a file in Linux?
Use the chown
command to change file ownership.
How can you check the permissions of a file?
The ls -l
command displays the file permissions in detail.
What is the difference between su
and sudo
?
su
switches to another user, often root, requiring that user’s password. sudo
runs a command with root privileges using the current user’s password.
How do you display the first few lines of a file?
The head
command displays the first few lines of a file.
How do you search for a specific text string in files?
Use the grep
command to search for a text string in files.
What command would you use to display active processes?
The ps
command displays active processes, or top
for an interactive view of running processes.
What is the purpose of the kill
command?
The kill
command is used to terminate a process by its PID (Process ID).
How can you view system memory usage?
Use the free
command or top
to view system memory usage.
What is the difference between hard and soft links?
A hard link points directly to the file’s data on disk, while a soft link (symbolic link) is a reference to another file’s path.
What command shows the disk usage of a directory and its contents?
The du
command shows the disk usage of a directory and its contents.
How do you display the IP address of the machine?
Use the ip addr
or ifconfig
command to display the IP address.
What is the purpose of the /etc/hosts
file?
The /etc/hosts
file maps hostnames to IP addresses for local name resolution.
What command is used to download files from the internet?
The wget
or curl
command is used to download files from the internet.
What is the cron
daemon used for?
The cron
daemon is used to schedule recurring tasks at specified intervals.
How do you display the last 10 lines of a log file?
The tail
command shows the last 10 lines of a file, or tail -f
for real-time updates.
How do you check the status of all services on a Linux system?
Use systemctl list-units --type=service
to check the status of all services.
What is virtualization?
Virtualization is the process of creating virtual instances of computer resources, such as servers, storage, and networks.
What is the difference between a virtual machine and a container?
A virtual machine is a full operating system environment running on a hypervisor, while a container shares the host OS kernel and runs in isolated processes.
What is a hypervisor?
A hypervisor is software that allows multiple virtual machines to run on a single physical host, with each VM isolated from others.
How do Type 1 and Type 2 hypervisors differ?
Type 1 hypervisors run directly on hardware (bare-metal), while Type 2 hypervisors run on top of an existing operating system.