Linux Commands Flashcards
To learn commonly used basic Linux commands.
Command to list directory contents?
ls [options]
Command to create a new directory?
mkdir [options] [directory name]
Command to change to a directory?
cd /[directory path]
Command to copy files and directories?
cp [options] [source] [destination]
Command to display a file’s content to the standard output device (usually your monitor)?
cat [filename]
Command to change a file’s permission?
chmod [options] mode [filename]
Command to change a file’s owner?
chown [options] filename
Command to clear a command line screen/window for a fresh start?
clear
Command to display or set the system date and time?
date [options]
Command to display used and available disk space?
df [options]
Command to determine how much space each file takes up?
du [options]
Command to determine what type of data is within a file?
file [options] [filename]
Command to search for files matching a provided pattern?
find [pathname] [expression]
Command to search files or output for a particular pattern?
grep [options] pattern [filename]
Command to stop a process?
kill [options] pid
Note:
If a process refuses to stop, use “kill -9 pid”
Command to view the contents of a file one page at a time?
less [options] [filename]
Command to create a shortcut?
ln [options] [source] [destination]
Command to search a copy of your file system for the specified filename?
locate [filename]
Command to send a print job?
lpr [filename]
Command to display information for a specified command?
man [command]
Command to rename or move file(s) or directories?
mv [options] [source] [destination]
Command to allow system administrator to change any password?
passwd [name] [new password]
Command to display a snapshot of currently running processes?
ps [options]
Command to display the pathname for the current directory?
pwd
Command to remove (delete) files and/or directories?
rm [options] [directory or filename]
Command to delete empty directories?
rmdir [options] [directory]
Command to remotely log into another Linux server, over the network?
ssh [options] [user]@[hostname]
Note:
To leave an SSH session type “exit”
Command to switch to another user account?
su [options] [user[arguments]]
Command to display the last n lines of a file (default is 10)?
tail [options] [filename]
Command to store and extract files from a tarfile (.tar) or tarball (.tar.gz or .tgz)?
tar [options][filename]
Command to display the resources being used on your system?
top
Note:
Press “q” to quit
Command to create an ampty file with a specified filename?
touch [filename]
Command to display who is logged onto the system?
who [options]
Command to stop a service?
service [servicename] stop
Command to start a service?
service [servicename] start
Command to restart a service?
service [servicename] restart
Command to display server uptime?
uptime
Command to display the status of a service
service [servicename] status