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.