Saved

Press the star next to a tool's name to save it.

All my tools

Linux Cheat Sheet

This Linux cheat sheet lists everyday commands for files, viewing, text, permissions, disk space and the system, with examples, search and a printable layout.

Restored your last values ·

Your search stays in your browser. Nothing is uploaded.

Commands

–

No commands match that search.

Recent results

A Linux cheat sheet keeps the commands you use most in one searchable place. This Linux cheat sheet covers working with files and folders, viewing files, sorting and cutting text, permissions and owners, disk space, and everyday system commands, each with a short example and a plain explanation. Search for a task such as copy or delete, filter by topic, and print the sheet to keep beside your keyboard.

The GNU core utilities

Every command on this sheet is one of the GNU core utilities, the standard programs for text and file manipulation that come with almost every Linux system. The GNU Coreutils manual documents each of them, grouped into areas such as output of entire files, output of parts of files, summarizing files, operating on sorted files, operating on fields and characters, directory listing, basic operations, changing file attributes, file space usage, working context, process control and file permissions. This sheet follows the same areas, in everyday language.

How to read a command

A command starts with the program name, followed by options and then the files or text it works on. Options usually start with a hyphen: ls -la combines -l for a long listing and -a for all files. Some options take a value, such as head -n 20 for 20 lines. File and folder names come last. Commands are case-sensitive, and so are file names, so Notes.txt and notes.txt are different files.

Commands to be careful with

  • rm deletes files permanently; there's no recycle bin to restore them from. rm -r deletes whole folders. Double-check the name before you press Enter.
  • mv and cp overwrite a file with the same name at the destination without asking, unless you add -i to be prompted.
  • chmod and chown on the wrong files can stop programs working or expose private files.
  • kill stops a running process; make sure you have the right process ID.

Permission numbers

chmod can set permissions with three digits, one each for the owner, the group and everyone else. Each digit adds up read (4), write (2) and execute (1). So 7 means read, write and execute; 5 means read and execute; 4 means read only; and 6 means read and write. 755 lets the owner do everything and others read and run the file, which suits scripts and folders. 644 lets the owner read and write and others only read, which suits ordinary files.

How to use the Linux cheat sheet

  1. Search for what you want to do, such as copy, size or permission.
  2. Choose a topic to show just one group.
  3. Copy the example and change the file names to your own.
  4. Print the sheet to keep a paper copy.

Getting more help

Most commands print a summary of their options when you add --help, for example ls --help. The full details for each command are in the GNU Coreutils manual, and many systems also have a manual page you can open with man followed by the command name. Start with the examples here, then look up the options you need.

Combining commands

Linux commands are designed to do one job each and to work together. You can send the output of one command into another, save output to a file, or run commands one after another. For example, sort a file and then remove repeated lines, or list a folder and count the entries. The GNU Coreutils manual includes a section on redirection and on working with the shell that explains these ideas in detail. Start with single commands from this sheet, then combine them as you get comfortable.

Paths and the current folder

Every command runs in a current folder, which pwd prints. A path that starts with / is absolute, such as /home/alice/notes.txt, and works from anywhere. A path that doesn't start with / is relative to the current folder, so notes.txt means the file in the folder you're in. Two dots, .., mean the folder above, and a single dot means the current folder. When a command doesn't find a file, check the path first.

Hidden files

Files and folders whose names start with a dot, such as .bashrc, are hidden from a plain ls. Add -a to see them, as in ls -la. Many settings files are hidden this way, so be careful not to delete them by mistake.

Practice safely

Try new commands in a test folder with copies of files, not on important data. Make a folder with mkdir, copy a few files into it, and experiment there. Commands such as rm and mv can't be undone, so a practice folder lets you learn without risk.

Common mistakes

  • Forgetting -r when copying or deleting folders.
  • Spaces in file names. Put the name in quotes, such as "my file.txt".
  • Using uniq on unsorted text. It only removes adjacent repeats, so sort first.
  • Running as the wrong user. Check with whoami before changing owners or permissions.

What next

Use this often? Add Linux Cheat to your Home screen.

Frequently asked questions

What does the Linux cheat sheet cover?

Files and folders, viewing files, working with text, permissions and owners, disk space, and everyday system commands from the GNU core utilities.

How do I copy a folder in Linux?

Use cp -r with the folder and the new name, for example cp -r photos photos-old.

How do I see how much disk space is free?

Run df -h for each drive, or du -sh followed by a folder name for the size of that folder.

What does chmod 755 mean?

The owner can read, write and run the file, and everyone else can read and run it.

Can I print the cheat sheet?

Yes. Press Print this cheat sheet to print the commands shown, or save them as a PDF.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools