You are on page 1of 1

Opensource.

com: Linux Common Commands Cheat Sheet By Seth Kenlon

Use this handy Linux command cheat sheet for executing common tasks
such as navigating files, installing software, and starting services.

Navigate files Installing software

List directories (with type indicator)


• On Fedora and CentOS, [COMMAND] is dnf
$ ls --file-type • On Ubuntu and Debian, [COMMAND] is apt
• On OpenSUSE, [COMMAND] is zypper
• Other distributions may use different commands
Change directory to ``example``
$ cd example Search for an application called example
$ sudo [COMMAND] search example
Move up one directory
$ cd .. Install an application called example
$ sudo [COMMAND] install example
Move up two directories
$ cd ../.. Uninstall an application called example
$ sudo [COMMAND] remove example
Change to home directory
$ cd ~
Services

Get current directory Start services


$ pwd $ sudo systemctl start example

Get absolute path to a file or folder Stop services


$ readlink -f example $ sudo systemctl stop example

Get file type of ``example.ext`` Get status of services


$ file example.ext $ sudo systemctl status example

File management

Copy a file in place Safely remove a file


$ cp example.txt example-1.txt $ trash example.txt

Copy a file to Documents Remove a file (without trash command)


$ cp example.txt ~/Documents/example-1.txt $ mv example.txt ~/.local/share/Trash/files

Move a file to Documents Permanently delete a file


$ mv example.txt ~/Documents $ shred example.txt

Create a directory (folder) Download a file from an network location


$ mkdir example $ wget http://example.com/file

Remove an empty directory


$ rmdir example

opensource.com Twitter @opensourceway | facebook.com/opensourceway | CC BY-SA 4.0

You might also like