Linux Utility Programs and Bash
Unix-based systems (such as Linux and MacOS) provide utility programs to perform various systems tasks. These utilities are via command-line interface. Bash is command-line processor and language used to execute these command. Bash is supported in Linux and MacOS. In Windows, a partial support is implemented in Git Bash. Also, come of the commands are implemented in Terminal of JetBrains IDEs (PyCharm, IntelliJ IDEA, CLion, etc.).
Main Bash commands
man
- prints documentation on other commandspwd
- prints current working directoryls
- prints directory contentscd
- changes current directorymkdir
- creates a new directoryfile
- determines file typeecho
- prints messages to the standard outputcp
- copies files and foldersmv
- renames or moves files or foldersrm
- deletes files or folderssu
- run a command with substitute user (e.g. root)exit
- causes Bash to exituname
- print system informationwhich
- locate a command
Installing additional programs in Linux Ubuntu
acos@acos-vm:~$ su
root@acos-vm:/home/acos# apt install mc
root@acos-vm:/home/acos# exit
Creating, editing and viewing source code:
cat
- concatnates and prints text fileshead
- outputs the first part of filestail
- outputs the last part of filesnano
- simple console code editormcedit
- mcedit simple editor from Midnight Commandervim
- Vi IMproved, a programmer’s text editor
Compiling and running programs in C
-
Use the following commands (work in MacOS too).
Compiling:
gcc hello.c -o hello.c
Running:
./hello
Getting information on CPU configuration
Using utility lscpu
:
lscpu
Viewing virtual file /proc/cpuinfo
:
less /proc/cpuinfo