Basic Commands for Linux

This is a small guide with basic commands for a lot of linux distributions. Use this cheatsheet to control your Linux without the need to look at the GUI.

Some Basics

This one should be quite obvious and easy. Next to navigating through the filesystem some other commands regarding the systems can be found here.

Navigating through the file system

To check in what working directory you are:
$ pwd

List the contents of the directory:
$ ls

To reveal more details about the current files and directories present in this directory, use the flag -l
$ ls -l

Change the directory:
$ cd directory-name

Some other helpful stuff

Receive sudo rights for the whole session. But beware: With great power, comes great responsibility.
$ sudo -i

Managing Files and Directories

Directories

Creating directory:
$ mkdir directory-name

Removing directory
$ rmdir directory-name

Files

One way to create a file is to use the command touch.
$ touch filename

To edit a file, use the editor nano. If the file is not existing yet, the editor will create it.
$ nano filename

Deleting a file:
$ rm filename

Updating your system

In short: Update the package source list, update all currently installed packages and then reboot.

The basic approach

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo reboot

The advanced approach

Pretty much the same thing, but just one line less.
$ sudo apt-get update && sudo apt-get upgrade
$ sudo reboot

Control the network interfaces

Check on the configuration of the network interfaces. You can find a lot of information there, it is also a great way to figure out the ip configuration. It might be necessary to utilize sudo.

$ ifconfig

Reading information of only the wlan0 interface:
$ ifconfig wlan0

Activating the eth0 interface:
$ sudo ifconfig eth0 up

Deactivating the eth0 interface:
$ sudo ifconfig eth0 down

Go Back