0% found this document useful (0 votes)
236 views6 pages

Ubuntu Linux Basic Commands PDF

The document discusses various basic Linux commands for network configuration, troubleshooting, and system information. It describes commands like ifconfig for configuring network interfaces and IP addresses, ping and traceroute for testing network connectivity, and netstat, dig, and nslookup for displaying DNS information. Additional commands covered include route, system-config-network for graphical network configuration, hostname, sudo, and apt-get. The document also lists commands for displaying hardware, storage, memory, and process information.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
236 views6 pages

Ubuntu Linux Basic Commands PDF

The document discusses various basic Linux commands for network configuration, troubleshooting, and system information. It describes commands like ifconfig for configuring network interfaces and IP addresses, ping and traceroute for testing network connectivity, and netstat, dig, and nslookup for displaying DNS information. Additional commands covered include route, system-config-network for graphical network configuration, hostname, sudo, and apt-get. The document also lists commands for displaying hardware, storage, memory, and process information.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 6

Ubuntu linux Basic commands

1.ifconfig :
ifconfig​ (​interface configurator​) command is use to initialize an interface, assign ​IP Address​ to interface
and ​enable​ or ​disable​ interface on demand. With this command you can view ​IP
Address​ and ​Hardware​ / ​MAC address​ assign to interface and also ​MTU​ (​Maximum transmission unit​)
size.

Ex:ifconfig
2.ifconfig ​eth0​:
ifconfig​ with interface (​eth0​) command only shows specific interface details like ​IP Address​, ​MAC
Address​ etc. with ​-a​ options will display all available interface details if it is disable also.

Ex:ifconfig eth0

3.​ Assigning IP Address and Gateway


Ex: ifconfig eth0 192.168.1.50 netmask 255.255.255.0

4.​ Enable or Disable Specific Interface


Ex : ​Enable eth0 : ifup eth0
Disable eth0 : ifdown eth0

5 .Dhclient(to release the IP address) 


Use this command to release (-r option) your IP address and get a new one from your 
DHCP server. 

EX: sudo dhclient –r 


6​.​ PING Command
PING​ (​Packet INternet Groper​) command is the best way to test connectivity between ​two nodes​.
Whether it is ​Local Area Network​ (​LAN​) or ​Wide Area Network​ (​WAN​). Ping use ​ICMP​ (​Internet Control
Message Protocol​) to communicate to other devices. You can ping host name of ​ip address​ using below
command.

Ex: ping ​www.google.com


7.​TRACEROUTE Command
traceroute​ is a network troubleshooting utility which shows number of hops taken to reach destination
also determine packets traveling path. Below we are tracing route to global ​DNS server IP Address​ and
able to reach destination also shows path of that packet is traveling.

Ex: tracerout www.google.com


8.​ NETSTAT Command
Netstat​ (​Network Statistic​) command display connection info, routing table information etc. To displays
routing table information use option as​ -r​.

Ex: netstart –r
9.​DIG Command
​ NS​ related information like ​A Record​, ​CNAME​, ​MX Record​ etc.
Dig​ (​domain information groper​) query D
This command mainly use to troubleshoot ​DNS​ related query.

EX: dig ​www.google.com


10.​NSLOOKUP Command
nslookup​ command also use to find out ​DNS​ related query. The following examples shows ​A Record​ (​IP
Address​) of ​tecmint.com​.

EX:nslookup ​www.google.com
11.​ ROUTE Command
route​ command also shows and manipulate ​ip​ routing table. To see default routing table in ​Linux​, type
the following command.

Ex: route

12.​ GUI tool system-config-network


Type ​system-config-network​ in command prompt to configure network setting and you
will get nice ​Graphical User Interface​ (​GUI​) which may also use to configure ​IP
​ ateway​, D
Address​, G ​ NS​ etc. as shown below image.

EX:system-config-network
13.​ HOSTNAME Command
hostname​ is to identify in a network. Execute ​hostname​ command to see the hostname
of your box. You can set hostname permanently in ​/etc/sysconfig/network​. Need to
reboot box once set a proper hostname.

EX: hostname
13.​ sudo 
This SuperUserDo is the most important command Linux newbies will use. Every single 
command that needs root’s permission, need this sudo command. You can use sudo before 
each command that requires root permissions – 

Ex:​ sudo su
14.​ ​APT commands
Ex:Sudo apt-get update
● Install a package locally: sudo apt-get install .​ /package.deb​. 
● Install a package from the repository: sudo apt-get install 
package​. 
● Uninstall a package from the repository: sudo apt-get purge 
package​. 
● Remove packages that are no longer needed: sudo apt-get autoremove
To update/upgrade the packages from this command is useful
15.​ lscpu: list CPU and processor info 
Ex: iscpu 

15: hwinfo: generic hardware information 


EX:hwinfo
16. lspci: PCI busses, including graphics card, 
network adapter 
Ex:lspci 
17. lsblk: list block devices (storate and partitions) 
Ex: lsblk 
18. df -h: disk free 
Ex:df-h 
19. free -h: total, free, used RAM 
Ex:free-h 
20.​ poweroff 
And the last one is ​poweroff​. Sometimes you need to ​poweroff​ directly from your terminal. 
This command will do the task. Don’t forget to add sudo at the beginning of the command 
since it needs root permission to execute poweroff. 

Ex: sudo poweroff 


21.​ ​Open Terminal
Ex: , Press ​Ctrl​ + ​Alt​ +​T​. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

22.​ A list of basic troubleshooting commands  


 

sudo apt-get
sudo Used before a command to run as root, or administrator.
update
ls Same as "dir"; lists the current directory. ls-ll
cp /dir/filename
cp Copy file.
/dir/filename
rm /dir/filename
rm Delete file.
/dir/filename
mv /dir/filename
mv Move file.
/dir/filename
mkdir Make a directory. mkdir /dirname
df Report file system disk space usage. df -h
dmesg Print or control the kernel ring buffer. dmesg
lspci Lists all PCI devices. lspci
lsusb Lists all USB devices. lsusb
lsmod Shows the status of modules in the Linux kernel. lsmod
cat Concatenate files and print on the standard output. cat /dir/logfile
grep Print lines of input matching a specified pattern. grep intel
apt-get update, or
apt-get Update installer.
apt-get upgrade
A utility that collects configuration and diagnostic information about your system.
The utility needs to be installed first using the following command line: "sudo
sosreport sosreport
apt-get install sosreport". It is recommended you reboot your system after the
install before first running the utility.
 
 
 
 
 
 
 

You might also like