Linux Commands For Beginners 1671689214
Linux Commands For Beginners 1671689214
The command-line interface is one of the nearly all well-built trademarks of Linux. There exists
an ocean of Linux commands, permitting you to do nearly everything you can be under the
impression of doing on your Linux operating system. Although, this to the end of time creates a
problem: by all of so copious commands accessible to manage, you don't comprehend where and
at which point to fly learning them, especially when you are learner. If you are facing this problem,
and are peering for a painless method to begin your command line journey in Linux, you've come
to the right place, as in this, we will launch you to a hold of well-liked and helpful Linux
commands.
Description:
Command:
date
Description:
Display calendar.
1
Command:
cal
Description:
Command:
Description:
Command:
cal 8 2016
Description:
2
Used to clear the terminal window.
Command:
clear
Description:
Command:
exit
Description:
Command:
free
3
Description:
Command:
free -b
Description:
Command:
free -k
Description:
Command:
free -m
4
Description:
Command:
passwd
Description:
Command:
shutdown
Description:
Command:
5
shutdown -h now
Description:
Command:
shutdown -h +10
Description:
Command:
echo $PWD
Description:
6
Command:
echo $OLDPWD
Description:
Command:
!11
Description:
Command:
history
Description:
7
Power off or reboot the Operating system.
Command:
sudo reboot
Description:
Command:
ip address
Description:
Command:
ls -s
8
Description:
Command:
mount
Description:
Command:
du
Description:
Command:
uptime
9
Description:
Command:
Description:
Command:
Description:
View and change the configuration of the network interfaces on the system.
Command:
ifconfig
10
Description:
Command:
ls
Description:
Command:
ps
Description:
Command:
11
df
Description:
Command:
df -H
Description:
Command:
rm -r *
Description:
12
Command:
top
Description:
Command:
reboot
Description:
Command:
kill
Description:
13
Command:
cd
Description:
Command:
login
Description:
Command:
lsof
Description:
14
List USB devices.
Command:
lsusb
Description:
Command:
Description:
Command:
15
Description:
Command:
Description:
Command:
Description:
Report information about the users currently on the machine and their processes.
Command:
16
Description:
Command:
pwd
Description:
Command:
lscpu
Description:
Command:
17
nproc
Description:
Command:
init 6
Description:
Command:
init 0
Description:
18
Follow me on LinkedIn for more content: LinkedIn
Command:
ls -lrt
Description:
Report information about storage devices such as hard disks, flash drives etc.
Command:
lsblk
Description:
Command:
echo $?
Description:
19
Lists a few useful info commands.
Command:
info
Description:
Command:
cal -y
Description:
Command:
service --status-all
20
Description:
Command:
date +%T
Description:
Tells when the user last logged on and off and from where.
Command:
last 1 username
Description:
Command:
ls -X
21
Description:
Command:
man pwd
Description:
Command:
pstree
Description:
Command:
22
reset
Description:
Command:
date -d fri
Description:
Command:
du a
Description:
23
Command:
acpi
Description:
Command:
cd ../..
Description:
Command:
cd -
Description:
24
Command:
help
Description:
Command:
last yourusername
Description:
Command:
mkdir myfiles
Description:
25
Remove the directory myfiles.
Command:
rmdir myfiles
Description:
Command:
passwd -d root1
Description:
Command:
sudo su root1
26
Description:
Command:
logout
Description:
Command:
useradd "root1"
Description:
Command:
passwd "root1"
27
Description:
Command:
!!
Description:
Command:
whoami
Description:
Command:
28
logname
Description:
Command:
uname
Description:
Command:
uname -v
Description:
29
Command:
uname -o
Description:
Command:
uname -m
Description:
Command:
uname --version
Description:
30
Print the kernel release.
Command:
uname -r
Description:
Command:
uname -n
Description:
Command:
netstat -a
31
Description:
Command:
netstat -at
Description:
Command:
netstat -au
Description:
Command:
Netstat -I
32
Description:
Command:
netstat -It
Description:
Command:
netstat -lu
Description:
Reveal all the information about the current user (user id, username, group id,
group name etc.).
Command:
33
id
Description:
Reveal all the information about the user "root1" (user id, username, group id,
group name etc.).
Command:
id root1
Description:
Command:
arch
Description:
34
Command:
fc-list
Description:
Command:
Description:
Command:
Description:
35
install apache (Ubuntu).
Command:
Description: upgrade
apache (CentOS).
Command:
Description: upgrade
apache (Ubuntu).
Command:
36
Description:
Command:
Description:
Command:
Description:
Command:
date --help
37
Description:
Command:
ss -tup
Description:
Command:
ss -tupl
Description:
Command:
38
netstat -lx
Description:
Command:
ifconfig
Description:
Command:
ifconfig -a
Description:
39
Command:
Description:
Tells you how many lines, words, and characters there are in a file (1.txt).
Command:
wc 1.txt
Description:
Command:
gzip 1.txt
Description:
40
Uncompresses file (1.txt) compressed by gzip.
Command:
gunzip 1.txt
Description:
Command:
cat 1.txt
Description:
Display calendar.
Command:
ncal
41
Description:
Command:
rm 1.txt
Description:
Command:
mv 1.txt 0.txt
Description:
Command:
cp 1.txt 0.txt
42
Description:
Command:
touch test.txt
Description:
Command:
tail 1.txt
Description:
Command:
tail -n N 1.txt
43
Description:
Command:
wc -w 1.txt
Description:
Command:
wc -m 1.txt
Description:
Command:
44
wc -L 1.txt
Description:
Print information about usb ports, graphics cards, network adapters etc.
Command:
lspci
Description:
Command:
less 1.txt
Description:
45
Command:
cal -3
Description:
Compare the contents of three files (1.txt, 2.txt, 3.txt) line by line.
Command:
Description:
Command:
Description:
46
Perform byte-by-byte comparison of two files (1.txt, 2.txt).
Command:
Description:
Prints the CRC checksum and byte count for the file "myfiles.txt".
Command:
cksum myfiles.txt
Description:
Command:
47
Description:
Append contents of files (1.txt, 2.txt, 3.txt) into one file (0.txt).
Command:
Description:
Append contents of files (1.txt, 2.txt, 3.txt) into one file (0.txt).
Command:
Description:
Append contents of files (1.txt, 2.txt, 3.txt) into one file (0.txt).
Command:
48
Shortcuts:
Description:
Writes contents of a file (0.txt) to output, and prepends each line with line number.
Command:
nl 0.txt
Description:
49
Command:
mkdir test cd
test pwd
touch test1.txt
Description:
Gather information about hardware components such as CPU, disks, memory, USB
controllers etc.
Command:
sudo lshw
Description:
Command:
sudo fdisk -l
50
Description:
Displays the line (good morning) in which the string (good) is found in the file
(1.txt).
Command:
Description:
Append contents of files (1.txt, 2.txt, 3.txt) into one file (0.txt) using for loop.
Command:
Description:
51
Command:
find test*
Description:
Command:
stat 1.txt
###
| Command | Description |
|:-----------------|-------------: |
| vi | Open vi editor |
| i | Go to Insert mode |
| | |
| a =20; b =64; | |
| print (a + b); | |
| Hit Escape to return to Normal mode. |
| :w hello.py | Save text |
| :q | Quit | |
python hello.py |Print the output:84 |
52
Description:
Command:
wget http://website.com/files/file.txt
Description:
Command:
hostid
Description:
Command:
file myfiles.txt
53
Follow me on LinkedIn for more content: LinkedIn
Description:
Command:
Description:
Command:
Description:
54
Command:
hostname -i
Description:
Command:
Description:
Command:
whatis cal
###
55
| Command | Description |
|:-----------------|-------------: |
| vi | Open vi editor |
| i | Go to Insert mode |
| Type some text. | |
| Hit Escape to return to Normal mode. |
| :w test.txt | Save text |
| :q | Quit | |
:q! |Quit without saving |
###
| Command | Description |
|:-----------------|-------------: |
| vi | Open vi editor |
| i | Go to Insert mode |
| $name = "Paul"; | |
| print "$name"; | |
| Hit Escape to return to Normal mode. |
| :w hello.pl | Save text |
| :q | Quit | |
perl hello.pl |Print the output: Paul |
###
| Command | Description |
|:---------------------------|-------------: |
| vi | Open vi editor |
| i | Go to Insert mode |
| echo "What is your name?" | |
| read PERSON | |
| echo "Hello, $PERSON" | |
| Hit Escape to return to Normal mode. |
| :w hello.sh | Save text |
| :q | Quit |
56
| sh hello.sh | Output: |
| | What is your name? |
| | If you enter: Zara Ali |
| | Hello, Zara Ali |
Description:
Check the network connectivity between host (your connection) and server
(Google server).
Command:
ping google.com
Description:
Command:
whereis cal
Description:
57
List the files in the bin directory.
Command:
ls /bin
Description:
List the files in the bin directory and the etc directory.
Command:
ls /bin /etc
Description:
Command:
mv test.txt ./newrepo
58
Description:
Command:
import os
os.system('ls')
59
import subprocess List all the files and directories in the
current directory
subprocess.call ('ls')
60
What is Linux and why is it so popular?
Whether you know it or not you are already using Linux (the best-known and most-used open-
source operating system) every day. From supercomputers to smartphones, the Linux operating
system is everywhere. As an operating system, Linux is a family of open-source Unix-like software
based on the Linux kernel - that sits underneath all of the other software on a computer, receiving
requests from those programs and relaying these requests to the computer's hardware. With regard
to careers, it is becoming increasingly valuable to have Linux skills rather than just knowing how
to use Windows. In general, Linux is harder to manage than Windows, but offers more flexibility
and configuration options.
Every desktop computer uses an operating system. The most popular operating systems in use
today are: Windows, Mac OS, and LINUX. Linux is the best-known notoriously reliable and
highly secure open-source portable operating system -- very much like UNIX -- that has become
very popular over the last several years -- created as a task done for pleasure by Linus Torvalds -
- computer science student at the University of Helsinki in Finland -- in the early 1990s and later
developed by more than a thousand people around the world.
Linux is fast, free and easy to use, that sits underneath all the other software on a computer − runs
your computer -- handling all interactions between you and the hardware i.e., whether you’re
typing a letter, calculating a money budget, or managing your food recipes on your computer, the
Linux operating system (similar to other Operating Systems, such as Windows XP, Windows 7,
Windows 8, and Mac OS X) provides the essential air that your computer breathes.
Linux is the most important technology advancement of the twenty-first century and Licensed
under the General Public License (GPL) that Linux uses ensures that the software will always be
open to anyone and whose source code is open and available for any user to check, which makes
it easier to find and repair vulnerabilities and it power the laptops, development machines and
servers at Google, Facebook, Twitter, NASA, and New York Stock Exchange, just to name a few.
Linux has many more features to amaze its users such as: Live CD/USB, Graphical user interface
(X Window System) etc.
Why LINUX?
Although Microsoft Windows (which is the most likely the victim of viruses and
malware) has made great improvements in reliability in recent years, it considered less
reliable than Linux. Linux is notoriously reliable and secure and it is free from constant
battling viruses and malware (which may affect your desktops, laptops, and servers by
corrupting files, causing slowdowns, crashes, costly repairs and taking over basic
functions of your operating system) – and it keep yourself free from licensing fees i.e.,
zero cost of entry ... as in free. You can install Linux on as many reliable computer
ecosystems on the planet as you like without paying a cent for software or server
licensing. While Microsoft Windows usually costs between $99.00 and $199.00 USD for
each licensed copy and fear of losing data.
Kernel is the core part of Linux Operating System and interacts directly with hardware. It is
responsible for all major activities of the Linux operating system.
• System Library
System libraries are special programs using which application programs accesses Kernel's features.
• System Utility