Your First Linux Commands

What You'll Learn

This is the absolute beginner's guide to the most essential Linux commands. After reading this, you'll be able to navigate folders, create and delete files, copy things around, and view file contents — all from the terminal.

Working with Files

mkdir — Create a Folder

mkdir my-project                  # Create one folder
mkdir -p projects/web/frontend    # Create nested folders (parents too)

touch — Create an Empty File

touch notes.txt                   # Create a new empty file

cp — Copy

cp file.txt backup.txt            # Copy a file
cp -r folder/ backup-folder/      # Copy an entire folder recursively

mv — Move or Rename

mv old-name.txt new-name.txt      # Rename a file
mv file.txt /home/alex/docs/     # Move a file to another folder

rm — Delete (Be Careful!)

rm file.txt                       # Delete a single file
rm -r folder/                     # Delete a folder and everything inside it
# WARNING: There is no recycle bin. Deleted files are gone!

cat — View File Contents

cat notes.txt                     # Display the entire file
head -n 5 notes.txt               # Show just the first 5 lines
tail -n 10 notes.txt              # Show just the last 10 lines

Practice Exercise

Try this sequence in your terminal:

cd ~
mkdir linux-practice
cd linux-practice
touch file1.txt file2.txt
echo "Hello Linux!" > file1.txt
cat file1.txt
cp file1.txt file3.txt
mv file2.txt renamed-file.txt
ls -la
cd ..
rm -r linux-practice

Troubleshooting

What's Next?

You know the basics! Now learn how Linux controls who can access your files:

Understanding File Permissions →