Linux Commands Flashcards
ls
List the contents of a directory.
cd
Change the current working directory.
pwd
Print the current working directory.
mkdir
Create a new directory.
rmdir
Remove an empty directory.
rm
Remove files or directories.
cp
Copy files or directories.
mv
Move or rename files or directories.
touch
Create an empty file or update the access and modification times of an existing file.
cat
Concatenate and display files.
less
View the contents of a file one screen at a time.
grep
search for a string in groups of files. When it finds a pattern that matches in more than one file, it prints the name of the file, followed by a colon, then the line matching the pattern.
find
Search for files in a directory hierarchy based on criteria such as name, size, or modification time.
chmod
Change the file permissions.
whoami
Display the username of the current user.
echo
Output text or variables to the terminal or a file.
man / -h
Display the manual page for a specified command or keyword.
su
Switch to another user account or temporarily elevate privileges.
ps
Display information about running processes. single snapshot and does not continuously run.
systemctl
manages both system and service configurations, enabling administrators to manage the OS and control the status of services
sha256sum
Calculate and verify SHA256 checksums for files.
&
Run a command in the background, allowing other tasks to be performed simultaneously.
&&
Execute the next command only if the previous command has succeeded (returned a zero exit status).
>
Redirect standard output from a command to a file, overwriting the file’s existing contents.
> >
Redirect standard output from a command to a file, appending to the file’s existing contents.
top
Display information about running processes. continuous until stopped.
kill
Terminate a process by sending a signal.
tar
Create, extract, or list the contents of a tar archive.
gzip
Compress or decompress files using the gzip format.
ssh
Secure Shell client for remote logins and command execution.
scp
Securely copy files between hosts using SSH.
wget
Download files from the web.
diff
Compare files line by line and display differences.
curl
Transfer data from or to a server using various protocols, often used for API interactions.
history
Display the command-line history.
alias
Create a shorthand or alias for a longer command.
yum
Package management system for Red Hat-based systems.
apt
Package management system for Debian and Ubuntu-based systems.
groupdel
Delete a group.
groupadd
Create a new group.
useradd
Create a new user account.
crontab
Schedule tasks to run at specific times, manage the cron table for a user.
traceroute
Display the route and transit delays of packets across an IP network.
ping
Send network packets to test the reachability of a host on an IP network.
ifconfig
Display and configure network interfaces.
uname
Display system information, such as the operating system name, kernel version, and hardware platform.
userdel
Delete a user account and related files.
apropos
Search the manual page names and descriptions for a specified keyword, helping to find relevant commands or manual pages based on a particular topic or functionality. Equivalent to using man -k.
tree
displays the directory structure of a given path in a tree-like format. It shows the nested arrangement of directories and files, making it easier to visualize the hierarchy of the filesystem.
which
locates the executable file associated with a given command. It searches through the directories listed in the PATH environment variable and returns the path of the first match it finds.
locate
searchs for files and directories by name. It uses a database created by the ‘updatedb’ command to perform a fast search. It is case-insensitive by default but can be made case-sensitive using the ‘-i’ option.
wc
counts the number of lines, words, and bytes in a file. It can also count characters if the ‘-m’ option is used.
What is tar used for in linux?
tar is used for archiving files (combining all files into one)
What is gzip used for in linux?
gzip is used for compressing file (making the file size smaller)
dpkg
used to manage Debian packages (.deb files) on Debian and Debian-based Linux distributions.
pico
text editor that provides less features and less complexity
usermod
used to modify the user’s account
passwd
used to change or reset the password of the user’s account
groupmod
used to modify a group
dnf
updated version of yum command and used to install and remove software on Red Hat
rpm
low-level too that is used to install and remove software on Red Hat
ip
used for configuring network interfaces. updated version of ‘ifconfig’
dig
used to query the DNS to get information about the different DNS records
what does the ‘$’ do?
used to reference the value of a variable.
chsh
change the shell you are using. -s to change default and put the path to the shell after.
*
wildcard. b* for example, will show all files starting with letter ‘b’
?
wildcard for a single letter
df
used to display the amount of available and used disk space. Also displays the file system type and its mount point.
du
used to estimate the disk pace usage of a file or directory. It shows the size of the file or directory, as well as the size of its subdirectories, if any.
What are the 3 file descriptors?
Data Stream for Input
STDIN – 0
Data Stream for Output
STDOUT – 1
Data Stream for Output that relates to an error occurring.
STDERR – 2
What does < do?
uses file or stream as input for a command instead of typing
What does EOF function do?
ends user input
What does ‘«’ do?
is used to pass multiple lines of input to a command. It allows you to define a block of input text within a script or command line, and that block will be passed as input to the command.
How to redirect errors?
‘command’ ‘2> /dev/null’
What does | do?
redirects STDOUT from one command to be processed by another