Basic File Opera ons
ls List files in a directory.
cp Copy a file.
mv Move (rename) a file.
rm Remove (delete) a file.
ln Create links (alterna ve names) to a file.
Directory Opera ons
cd Change your current directory.
pwd Print the name of your current directory.
basename Print the final part of a file path, usually the filename.
dirname Print a file path without its final part.
mkdir Create (make) a directory.
rmdir Delete (remove) an empty directory.
rm -r Delete a nonempty directory and its contents.
Viewing Files
cat View files in their en rety.
less View text files one page at a me.
nl View text files with their lines numbered.
head View the first lines of a text file.
tail View the last lines of a text file.
strings Display text that’s embedded in a binary file.
od View data in octal (base 8) or other formats.
Crea ng and Edi ng Files
nano A simple text editor found in virtually all Linux distros.
emacs A powerful text editor from Free So ware Founda on.
vim A powerful text editor based on Unix vi.
Proper es of Files
stat Display a ributes of files and directories.
wc Count bytes, words, and lines in a file.
du Measure disk usage of files and directories.
file Identify (guess) the type of a file.
mimetype Identify (guess) the MIME type of a file.
touch Change timestamps of files and directories.
chown Change owner of files and directories.
chgrp Change group ownership of files and directories.
chmod Change protection mode of files and directories.
umask Set a default mode for new files and directories.
lsattr List extended attributes of files and directories.
chattr Change extended attributes of files and directories.
Loca ng Files
find Locate files in a directory hierarchy.
xargs Turn a list of files into a list of commands (and much more).
locate Create an index of files, and search the index for a string.
which Locate executables in your search path (command).
type Locate executables in your search path (bash built-in).
whereis Locate executables, documenta on, and source files.
Manipula ng Text in Files
grep Find lines in a file that match a regular expression.
cut Extract columns from a file.
paste Append text from mul ple files in columns.
column Organize text into columns.
tr Translate characters into other characters.
expand Convert from tabs to spaces.
unexpand Convert from spaces to tabs.
sort Sort lines of text by various criteria.
uniq Locate iden cal lines in a file.
tac Reverse a file line by line.
shuf Randomly shuffle the lines of a file (permuta on).
tee Write to a file and print on standard output, simultaneously.
Compressing, Packaging, and Encryp ng
tar Package mul ple files into a single file.
gzip Compress files with GNU Zip.
gunzip Uncompress GNU Zip files.
bzip2 Compress files in BZip format.
bunzip2 Uncompress BZip files.
bzcat Uncompress BZip data to standard output.
compress Compress files with tradi onal Unix compression.
uncompress Uncompress files with tradi onal Unix compression.
zcat Uncompress to standard output (gzip or compress).
zip Package and compress files in Windows Zip format.
unzip Uncompress and unpack Windows Zip files.
7z Package and compress/uncompress 7-Zip files.
munpack Extract MIME data to files.
mpack Convert a file to MIME format.
gpg Encrypt a file with the GNU Privacy Guard (GnuPG).
Comparing Files
diff Line-by-line comparison of two files or directories.
comm Line-by-line comparison of two sorted files.
cmp Byte-by-byte comparison of two files.
shasum Compute checksums of the given files.
md5sum Compute checksums of the given files (insecure).
PDF and PostScript File Handling
pdftotext Extract text from PDF files.
ps2ascii Extract text from PostScript or PDF files.
pdfseparate Extract individual pages from a PDF file.
pdftk Split, join, rotate, and otherwise manipulate PDF files.
pdf2ps, ps2pdf Convert between PDF and PostScript file formats.
ocrmypdf Perform op cal character recogni on (OCR) on a PDF.
Prin ng
lpr Print a file.
lpq View the print queue.
lprm Remove a print job from the queue.
Spellchecking
look Look up the spelling of a word quickly.
aspell Interac ve spelling checker.
spell Batch spelling checker.
Screen Output
echo Print simple text on standard output.
printf Print forma ed text on standard output.
yes Print repeated text on standard output.
seq Print a sequence of numbers on standard output.
clear Clear the screen or window
Dates and Times
cal Print a calendar.
date Print or set the date and me.
Version Control
git Perform version control using Git.
svn Perform version control using Subversion.