Where am I – Basic CLI

The Linux command line is powerful, but it might take a bit getting used to. In this lesson we start with some navigation and we’ll play with some files. Fun fact, a lot of these commands also work on the Mac command line.

In general when you login into a machine through SSH you’ll end up in the home directory of a user. In this case /home/pi but than. Here is a list of commands and a short explanation of their use.
Now that you have access to the command line, you can give them a try. We’ll get back to them later on in more detail.

CommandExplanation
lslist, show the content of the directory. Similar to dir in Windows
cdchange directory
clearclear the output on the screen
mkdirmake directory
rmdirremove empty directory
touchcreate file
rm remove file or not empty directory
cpcopy
mvmove
manmanual, works on all commands

When you are familiar with these basic commands, you can check out the following.

CommandExplanation
catdisplay content of a file
echoadd text to a file – compare > and >>
dfshow available/used disk space
du disk usage, show how the directory is build up
hostnameto find out the name of the machine
unamefind information about system, like distro, kernel, processor
sudosuper user do, in front of a command to have root privileges
aptdebian family packate manager
chmodchange access rights
chownchange owner/group
tar(un)pack tarball archives
unzipunpack zip archives

You can use your arrow keys (up and down) to go to to previous typed command, which saves typing.

Leave a Reply

Your email address will not be published. Required fields are marked *