Your comprehensive guide to BASH commands for Linux

0
19

BASH commands for Linux“Shell” software can be said to be the middleware between you and the operating system.It is the one who takes your orders and interprets them to the operating system to execute them.It is called “shell” because it hides the complexities of executing this process; it takes the order from you and returns the result without entering you in details.

There are two types of shell:

  • Graphical: (GUI-based Shell) such as GNOME, KDE, Xfce
  • Scripts: (CLI-based Shell) such as: sh, bash, csh

What matters to us is “BASH” scripts, because it combines the features of “csh” and “ksh,”

BASH commands for Linuxas well as it is the improving the first “shell” in “Unix” history, and most importantly, it is the default for most Linux systems and distributions.Another question may come to your mind and ask why the interest is in “Shell” scripts not the graphical?The answer is because the command line capabilities outweigh the capabilities of the graphical interface because they have many features and are easy to implement.In the following table we arranged the “BASH” commands for Linux from A-Z and added an example of each command, so we think it will be a big and influential factor at the beginning of your Linux journey.

 

Function Order
A
The command name changed
alias search = grep
alias
View a list of appropriate commands

apropos find

apropos
Find and install the package (program)
sudo apt-get install vlc
apt-get
Manage a package

aptitude update

aptitude
Interactive Spelling Checker

aspell check example.txt

aspell
Very complex editing of texts
awk ‘length ($ 0)> 72’ text.txt
awk
B
The file name is extracted only from its path

basename / usr / bin / sort

basename
Perform complex calculations that exist in a file

bc foo.bc

bc
Move a task to the background
grep -h ‘[ bg ] zip’ dirlist * .txt
bg
pressure   Or unpack a file

bzip2 foo.txt

bzip2
C
View Calendar cal
Read a file and copy it into another

cat file1.txt file2.txt

cat
Change the current working folder

cd folder_name

cd
Displays the Hardness Parthen

sudo cfdisk

cfdisk
The owner group changed the file

chgrp hope file.txt

chgrp
Change file permissions

chmod u = rw example.jpg

chmod
Change the owner of the file

sudo chown myuser myfile.txt

chown
Clear the contents of the screen . clear
Compare two files and view the difference

cmp file1.txt file2.txt

cmp
Compare two files and display similarities and differences

comm recipe.txt shopping-list.txt

comm
Copy files and folders

cp file1.txt newdir

cp
Split files into sections depending on the content
csplit -f cobol filename ‘/ procedure division /’ /par5./ / par16 ./
csplit
Separately separate a text field from a file and reassemble it
cut -c 3 file.txt
cut
D
To view or change the time date
To start writing calculations dc
To find out how much empty storage is in the hard drive df
Show the difference between two files

diff -y file1.txt file2.txt

diff
View files dir
Display the messages in the
dmesg > file.txt
dmesg
View the file space within a folder

du -s * .txt

du
E
To print text on the screen

echo Hello, World

echo
Detach removable media

eject cdrom

eject
Close the bash exit
Export the environment to specific programs

export PATH

export
F
Format a floppy disk fdformat
Modify the Parachine Table fdisk
Reset the task from the background . fg
Search for text within a file

fgrep “support” myfile.txt

fgrep
Select the file type

* file

file
Search for files in the file system tree

find. -L

find
Text Coordinator

fmt myfile.txt

fmt
Make the lines wrap when they exceed a certain limit

fold -w5 myfile.txt> newfile.txt

fold
View Meimori data free
Check the parsin and display errors

fsck / dev / sda2

fsck
View the processes that use the folder

. fuser

fuser
G
Displays lines that match a particular pattern

grep chope / etc / passwd

grep
Create a group for users

groupadd newgroup

groupadd
Delete the user group

groupdel newgroup

groupdel
Modify the user group groupmod
Contains the number of files owned by a particular group groups
Compress and uncompress files

gzip backup.tar

gzip
H
View the first section of the file

head myfile.txt

head
Get help for existing commands

help cd

help
View previous commands history
Set the name of the computer on the network hostname
I
Print the ID User and existing groups id
Take a picture of the screen and save it with a specific name

import photo.jpg

import
J
Show a list of active tasks jobs
Merge two file lines

join myfile1.txt myfile2.txt

join
K
Send a signal to the process to kill it

kill 123 543

kill
Kill operations by specifying their name

killall UnResponsiveProg

killall
L
View the contents of a file
less file.txt
less
Link two files with each other

link computer.txt hope.txt

link
Create a solid and symbolic link

ln public_html /myfile1.txt

ln
Find files by name
locate perl
locate
Displays the current user name logname
Print a file lprint
Exit Print File lprintd
View the contents of the folder ls
View open files lsof
M
Tool used in process compile Software from Source make
View the directory page for an order

man man

man
Create a new folder

mkdir myfiles

mkdir
View the contents of the file
more +3 myfile.txt
more
Connect the file system mount
Move or rename files and folders

mv myfile.txt myfiles

mv
N
Read and write data over the network

nc -p 31337 -w 5 host.example.com 42

nc
View network connection information netstat
Line numbering

nl list.txt

nl
O
Open the file in its default program open
P
Change the password of the current user passwd
Merge multiple file lines

paste file1.txt file2.txt

paste
Test the connection with the network ping
Format text for printing pr
View the path of the current working folder pwd
Q
Show unused and empty space quota
R
Copy the file from one device to another

rcp / mydirectory / myfile hope: otherdir /myfile

rcp
Restart the system reboot
Rename the file rename
View the file in reverse

rev file.txt

rev
Delete the file

rm myfile.txt

rm
Delete the folder

rmdir mydir

rmdir
S
Copy securely

scp remote-sys: document.txt

scp
Compare the two files
sdiff file1.txt file2.txt
sdiff
View Options shell shopt
Close the device shutdown
Arrange the text lines

sort file.txt

sort
Split files into partitions

split -b 22 newfile.txt new

split
View the status of the file

stat index.htm

stat
Executing the order with the requirements of the routine sudo
T
View the last lines of a file

tail myfile.txt

tail
Files Archiving tar
View processes that are running on the system top
Replace the lower case with the capital letters

echo “lowercase letters” | tr az AZ

tr
Determine the method of interpreting the command name type
U
Define default default permissions umask
Separate file system umount
Delete the alias of the command unalias
View file information

uname -a

uname
Converts spaces to the tab key (tab)

expand myfile.txt

unexpand
Report or delete the refined line

uniq myfile.txt

uniq
Decompress files rar unrar
Show how long the system works uptime
Create a new user useradd
Delete a user userdel
Modify the user usermod
V
Modify a file

vi myfile.txt

vi
Show a snapshot of how much the system consumed for different resources vmstat
W
Displays the number of lines, words, and number of bytes in a file

wc myfile.txt

wc
View all folders that contain program files

whereis perl

whereis
View all users currently on the device who
Displays the current user name whoami
Upload the site page on your device

wget https://www.computerhope.com

wget
Send a message to another user write
X
Build and execute orders from the standard income stream
cut -d: -f1 </ etc / passwd | sort | xargs echo
xargs
Compress or unpack files . xz   And . lzma xz
Z
Compress files zip

To find out all the available information about an order, place the word “help” after the command, and you will see all the information next to the additions available to it, and how to write the command correctly.

LEAVE A REPLY

Please enter your comment!
Please enter your name here