# Linux commands for common tasks

## Navigate files

### List directories (with type indicator)

```
$ ls --file-type
```

### Change directory to ``example``

```
$ cd example
```

### Move up one directory

```
$ cd ..
```

### Move up two directories

```
$ cd ../..
```

### Change to home directory

```
$ cd ~
```

### Get current directory

```
$ pwd
```

### Get absolute path to a file or folder

```
$ readlink -f example
```

### Get file type of ``example.ext``

```
$ file example.ext
```


## File management

### Copy a file in place

```
$ cp example.txt example-1.txt
```

### Copy a file to Documents

```
$ cp example.txt ~/Documents/example-1.txt
```

### Move a file to Documents

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

### Create a directory (folder)

```
$ mkdir example
```

### Remove an empty directory


```
$ rmdir example
```

### Safely remove a file

```
$ trash example.txt
```

### Remove a file (without trash command)

```
$ mv example.txt ~/.local/share/Trash/files
```

### Download a file from an network location

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


## Installing software

* On Fedora and CentOS, use ``dnf``
* On Ubuntu and Debian, use ``apt``
* On OpenSUSE, use ``zypper``
* Other distributions may use different commands

### Search for an application called example

```
$ sudo [COMMAND] search example
```

### Install an application called example

```
$ sudo [COMMAND] install example
```

### Uninstall an application called example

```
$ sudo [COMMAND] remove example
```


## Services

### Start services

```
$ sudo systemctl start example
```

### Stop services

```
$ sudo systemctl stop example
```

### Get status of services

```
$ sudo systemctl status example
```