Linux Commands Flashcards
What does the pwd command do in Linux?
Shows the current directory location.
What is the purpose of the ls command?
Lists the contents of the current directory
How do you navigate to and from directories using the cd command?
Example: cd /var/log.
Move to home directory: cd ~
Move to the parent directory: cd ..
Gives the current directory name: cd .
How do you move or rename files with the mv command?
Example: mv test4.txt test3.txt /home/student01/Documents/.
What is the command to copy files and directories in Linux?
cp.
Example: cp test1.txt test2.txt /home/student01/Documents.
How do you remove files and directories with the rm command?
rm does not remove directories by default; use -r for recursive removal or -d if the directory is empty.
What command is used to find files in Linux?
find
How do you concatenate files and view file data using the cat command?
Show contents of a file: cat test1.txt
Show contents of two files: cat test1.txt test2.txt
Combine contents of 2 files and output results to another file: cat test1.txt test2.txt > test3.txt
How do you search for patterns in files using the grep command?
Example: cat test1.txt | grep had.
Name two file editors commonly used in Linux.
nano and vi.
How do you install software on Debian/Ubuntu systems?
apt install. Example: apt install net-tools.
How do you install software on RHEL/CentOS systems?
yum install or dnf install. Example: yum install htop or dnf install htop.
What command elevates privileges to superuser in Linux?
sudo. Example: sudo apt install net-tools.
How do you switch users using the su command?
su switches to root if no options are specified. Example: su wbryan.
How do you change file permissions with the chmod command?
Example: sudo chmod a-w test1.txt or sudo chmod a+w test1.txt.
How do you change file ownership with the chown command?
Use chown. Example: sudo chown user:group file.
Which command configures network interfaces in Linux?
ifconfig. Example: ifconfig.
What is the currently preferred IP configuration utility in Linux?
ip. Example: ip addr.
How do you test the Domain Name System (DNS) in Linux?
dig.
Which commands provide a snapshot of current processes in Linux?
ps and top.
What command is used to terminate processes in Linux?
kill.
What does the command “man” do?
Manual for commands
What does the command df do?
displays information about total space and available space on a file system.
What does the command dd do?
Copy hard drives, partitions, CD drives, etc.
What does the command shutdown do?
Shuts down the system you’re working on.