File Commands Flashcards
ls
List
List files in a directory
ls -R
List all files in the subdirectory
ls -a
List all hidden files
cat
List the contents of a file
cat > filename
Creates a new file
diff
Compare the contents of two files line by line
tar
Extract, compress, and archive multiple files in linux
tar xf [yourfile_file.tar]
Extract file
tar czf
Creates a gzip compressed tar file
tar cf
Create an archive file from a file
gzip
Compress a file with the .gz extension
chmod
Change the read write and execute permissions of files and directories
chown
Change or transfer file ownership
rm
Remove a file
rm -r
Remove a directory recursively
wc
Print the number of words, lines, and bytes in a file
cp
Copy files from the current directory to a different directory
wget
Download files from the internet
cp -r
Recursively copy the contents of the first file to the second file
mv
To move or rename files
ln -s
Create a symbolic link
touch
Create a new file
More “file name”
Shows the contents of a file
head “filename”
Show the first ten lines of a file
tail “filename “
Show the last ten lines of a file
gpg -c
Encrypt a file
gpg
Decrypt a file
sudo
Perform task that need administrative or root permissions
locate
To search for a file or directory
find
To locate files within a directory
jobs
Displays current jobs
kill
Terminate an unresponsive program
killall
Terminates all running programs and processes except the one conducting the kill command
history
See the commands that you’ve entered before
man
Show manual instructions on Linux commands
zip
Compress files into a zip archive
unzip
Extract zipped files from a zip archive
top
Monitor system resource usage
ps
Show a snapshot of active processe
echo
Move data into a file
hostname
Know the name of your host/network
ping
Check connectivity to a server
ifconfig
Show IP addresses of all network interfaces
netstat
Show status of network
whois
Show more information about domain
dig
Show DNS info about a domain
host
Do an IP lookup for a domain
grep
Search for matching patterns in a file
Clear
Clear the terminal display
less
Command to read contents of a file one page at a time
sort
Arranges the contents of a file in a particular order
service
Start stop or restart a service or daemon by calling a script
mount
Mount file systems in linux
traceroute
Trace all hops the network too to reach the destination
ufw
Firewall command
Apt pacman yum rpm
Package managers depending on the distro
cal
Command line calendar
Whereis
Locate the binary source and manual pages for a command
whatis
Find what a command is used for
alias
Create a shortcut for regularly used commands