A brief introduction to the Terminal
Written by Stefan Radosavljevic 15 July 2018

Whether you are a Linux user or a MacOS, or even Windows, and you’re also a programmer or even SysAdmin / DevOps, Terminal is an inevitable and very powerful thing in the OS. This will be a brief description of the Terminal and its basic commands.

Basically, the bash shell is used by default. A shell is a program that uses commands assigned to it by the user (commands are defined, while new ones can be created) and forwards them to the OS that will show some output when executing the command. In addition to the bash shell (Bourne-Again shell), there is also sh and csh.

There are many standard Linux commands that are already installed along with the OS, which allow you to navigate through the system, install software packages, configure the system and applications, search the whole system or project, work with the git and more.
An instant when running a command is called the process.

pexels-photo-289927

It is very important to know that almost everything in Linux is case-sensitive, including file names and directories, commands, arguments, and other options.

Here is some popular terminal emulator you can install:

  • Mac OS X: Terminal (default), iTerm 2
  • Windows: PuTTY, cmd
  • Linux: Terminal, KDE Console, XTerm

An excellent addition to the terminal is zsh (oh my zsh), this is an open-source framework. It comes with a large number of functions, plugins, themes, so you can beautify your Terminal and save time when writing commands.

The information displayed in the command prompt can be modified by the user; this looks like the command prompt on Ubuntu: name @ example: ~ $

name: current username
example: hostname server
“~”: the current directory in which we are located. In bash, which is by default shell, tilde or “~”, it is a special character that actually represents the path of the “home” directory, in this case, it represents “/ home/name”
“$”: prompt symbol, this marks the end of the command prompt, followed by the input of the user’s keyboard

pexels-photo-207580

Linux commands:

uptime -> displays the time since the last boot time
whoami -> shows who you are
uname -> displays system information
whereis -> finds the location of the file that is running for the given program
screenfetch -> displays information about hardware and software (installation required)
top -> shows processes
free -> displays memory usage
history -> displays all commands that are written by the user in the past
date -> displays the time and date
calendar -> displays calendar (holidays etc.)
curl -> captures html code from the website and displays its content in the terminal
curl wttr.in/serbiapwd -> displays the directory in which we are currently located and its path
cd -> command to change the directory
mv -> move or rename a file / directory
cp -> copy the file / directory
ls -> list files / directories
mkdir -> command to create a new directory
rmdir -> command to remove the directory
rm -> command to remove files
rm -i -> command to remove files, it is necessary to confirm more once you want to remove the file
rm -rf -> removes the folder although it is not empty
touch -> is used to create a new text file
nano / emac / vim -> editors available in the OS
cat -> list the contents of the file in the terminal
clear -> removes everything that is written in the terminal (clear text from the terminal)
sudo -> super user do
are -> root user
sudo dpkg -i example.deb -> install .deb files
sudo dpkg -r example.deb -> uninstall
sudo dpkg -P example.deb -> uninstall and removing config files
sudo apt-get update && sudo apt-get upgrade -> update packages and upgrade
sudo apt-cache show packagename -> displays packages (repositories)
sudo apt-cache search something -> search programs and so on in packages
find. -type f -name “* .sass” -> to search everything in
system / project / folder (f – is for files) find. -type d -empty -> searches for empty folders (d – is for directories, folders)
sudo ufw enable / disable -> firewall enabling / disabling
chmod g + w somefile.txt or chmod u + r somefile.txt -> change (permission) of the authorization u-user g-group o-others w (4) r (2) x (1)
chmod 642 -> the first number belongs to the user, the other belongs to the group, and the third one belongs to others
wget -> download (downloads) files or pages via URL

 

BACK
Tags: , ,

LEAVE A COMMENT

JOIN THE MAILING LIST