<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>LastHop</title><link>http://lasthop.xyz/</link><description>Recent content on LastHop</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Wed, 20 Dec 2023 00:00:00 +0000</lastBuildDate><atom:link href="http://lasthop.xyz/index.xml" rel="self" type="application/rss+xml"/><item><title>Essential Linux commands for network engineers</title><link>http://lasthop.xyz/p/essential-linux-commands-for-network-engineers/</link><pubDate>Wed, 20 Dec 2023 00:00:00 +0000</pubDate><guid>http://lasthop.xyz/p/essential-linux-commands-for-network-engineers/</guid><description>&lt;img src="http://lasthop.xyz/p/essential-linux-commands-for-network-engineers/linux.png" alt="Featured image of post Essential Linux commands for network engineers" />&lt;h2 id="ls">&lt;strong>ls&lt;/strong>:&lt;/h2>
&lt;p>Lists directories and files in the current directory.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ ls
clab docker-compose downloads hugo package-lock.json scripts
compose docker-vol service lasthop powerlevel10k tf
&lt;/code>&lt;/pre>
&lt;h2 id="pwd">&lt;strong>pwd&lt;/strong>:&lt;/h2>
&lt;p>Prints the current working directory.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ pwd
/home/ubuntu
&lt;/code>&lt;/pre>
&lt;h2 id="cd">&lt;strong>cd&lt;/strong>:&lt;/h2>
&lt;p>Navigate through directories.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ cd clab
ubuntu@panda:~/clab$ cd
ubuntu@panda:~$
&lt;/code>&lt;/pre>
&lt;h2 id="mkdir">&lt;strong>mkdir&lt;/strong>:&lt;/h2>
&lt;p>Create directories.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ mkdir newdir
ubuntu@panda:~$ ls
clab docker-compose downloads hugo newdir powerlevel10k tf
compose docker-vol service lasthop package-lock.json scripts
&lt;/code>&lt;/pre>
&lt;h2 id="mv">&lt;strong>mv&lt;/strong>:&lt;/h2>
&lt;p>Move or rename files.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ mv downloads downloads_backup
ubuntu@panda:~$ ls
clab docker-compose downloads_backup hugo package-lock.json scripts
compose docker-vol service lasthop powerlevel10k tf
&lt;/code>&lt;/pre>
&lt;h2 id="cp">&lt;strong>cp&lt;/strong>:&lt;/h2>
&lt;p>Copy files.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ cp package-lock.json package-lock-backup.json
ubuntu@panda:~$ ls
clab docker-compose downloads hugo package-lock-backup.json package-lock.json powerlevel10k scripts
compose docker-vol service lasthop tf
&lt;/code>&lt;/pre>
&lt;h2 id="rm">&lt;strong>rm&lt;/strong>:&lt;/h2>
&lt;p>Delete files or directories.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ rm package-lock-backup.json
ubuntu@panda:~$ ls
clab docker-compose downloads hugo package-lock.json powerlevel10k scripts
compose docker-vol service lasthop tf
&lt;/code>&lt;/pre>
&lt;h2 id="touch">&lt;strong>touch&lt;/strong>:&lt;/h2>
&lt;p>Create blank/empty files.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ touch newfile.txt
ubuntu@panda:~$ ls
clab docker-compose downloads hugo newfile.txt package-lock.json powerlevel10k scripts
compose docker-vol service lasthop tf
&lt;/code>&lt;/pre>
&lt;h2 id="cat">&lt;strong>cat&lt;/strong>:&lt;/h2>
&lt;p>Display file contents on the terminal.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ cat newfile.txt
hello world
&lt;/code>&lt;/pre>
&lt;h2 id="clear">&lt;strong>clear&lt;/strong>:&lt;/h2>
&lt;p>Clear the terminal display.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ clear
&lt;/code>&lt;/pre>
&lt;h2 id="echo">&lt;strong>echo&lt;/strong>:&lt;/h2>
&lt;p>Print any text that follows the command.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ echo &amp;quot;hello world&amp;quot;
hello world
&lt;/code>&lt;/pre>
&lt;h2 id="less">&lt;strong>less&lt;/strong>:&lt;/h2>
&lt;p>Display paged outputs in the terminal.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ less package-lock.json
&lt;/code>&lt;/pre>
&lt;h2 id="man">&lt;strong>man&lt;/strong>:&lt;/h2>
&lt;p>Access manual pages for Linux commands.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ man ls
&lt;/code>&lt;/pre>
&lt;h2 id="uname">&lt;strong>uname&lt;/strong>:&lt;/h2>
&lt;p>Get basic information about the OS.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ uname -a
Linux panda 5.15.0-1049-oracle
&lt;/code>&lt;/pre>
&lt;h2 id="whoami">&lt;strong>whoami&lt;/strong>:&lt;/h2>
&lt;p>Get the active username.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ whoami
ubuntu
&lt;/code>&lt;/pre>
&lt;h2 id="tar">&lt;strong>tar&lt;/strong>:&lt;/h2>
&lt;p>Extract and compress files.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ tar -xvf archive.tar
&lt;/code>&lt;/pre>
&lt;h2 id="grep">&lt;strong>grep&lt;/strong>:&lt;/h2>
&lt;p>Search for a string within an output.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ grep &amp;quot;pattern&amp;quot; filename
&lt;/code>&lt;/pre>
&lt;h2 id="head">&lt;strong>head&lt;/strong>:&lt;/h2>
&lt;p>Return the specified number of lines from the top.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ head -n 5 filename
&lt;/code>&lt;/pre>
&lt;h2 id="tail">&lt;strong>tail&lt;/strong>:&lt;/h2>
&lt;p>Return the specified number of lines from the bottom.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ tail -n 5 filename
&lt;/code>&lt;/pre>
&lt;h2 id="diff">&lt;strong>diff&lt;/strong>:&lt;/h2>
&lt;p>Find the difference between two files.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ diff file1 file2
&lt;/code>&lt;/pre>
&lt;h2 id="cmp">&lt;strong>cmp&lt;/strong>:&lt;/h2>
&lt;p>Check if two files are identical.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ cmp file1 file2
&lt;/code>&lt;/pre>
&lt;h2 id="comm">&lt;strong>comm&lt;/strong>:&lt;/h2>
&lt;p>Combine the functionality of diff and cmp.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ comm file1 file2
&lt;/code>&lt;/pre>
&lt;h2 id="sort">&lt;strong>sort&lt;/strong>:&lt;/h2>
&lt;p>Sort the content of a file while outputting.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ sort filename
&lt;/code>&lt;/pre>
&lt;h2 id="export">&lt;strong>export&lt;/strong>:&lt;/h2>
&lt;p>Export environment variables.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:
&lt;/code>&lt;/pre>
&lt;h2 id="ps">&lt;strong>ps&lt;/strong>:&lt;/h2>
&lt;p>Display active processes.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ ps
PID TTY TIME CMD
1234 pts/1 00:00:01 bash
5678 pts/1 00:00:03 python
&lt;/code>&lt;/pre>
&lt;h2 id="kill-and-killall">&lt;strong>kill&lt;/strong> and &lt;strong>killall&lt;/strong>:&lt;/h2>
&lt;p>Kill active processes by process ID or name.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ kill 1234
ubuntu@panda:~$ killall python
&lt;/code>&lt;/pre>
&lt;h2 id="df">&lt;strong>df&lt;/strong>:&lt;/h2>
&lt;p>Display disk filesystem information.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 20G 15G 4.0G 80% /
&lt;/code>&lt;/pre>
&lt;h2 id="chmod">&lt;strong>chmod&lt;/strong>:&lt;/h2>
&lt;p>Change file permissions.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ chmod 755 script.sh
ubuntu@panda:~$ ls -l script.sh
-rwxr-xr-x 1 ubuntu ubuntu 0 Jan 1 12:00 script.sh
&lt;/code>&lt;/pre>
&lt;h2 id="chown">&lt;strong>chown&lt;/strong>:&lt;/h2>
&lt;p>Grant ownership of files or folders.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ chown ubuntu:ubuntu script.sh
ubuntu@panda:~$ ls -l script.sh
-rwxr-xr-x 1 ubuntu ubuntu 0 Jan 1 12:00 script.sh
&lt;/code>&lt;/pre>
&lt;h2 id="ifconfig">&lt;strong>ifconfig&lt;/strong>:&lt;/h2>
&lt;p>Display network interfaces and IP addresses.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ ifconfig
eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500
inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
&lt;/code>&lt;/pre>
&lt;h2 id="traceroute">&lt;strong>traceroute&lt;/strong>:&lt;/h2>
&lt;p>Trace all the network hops to reach the destination.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ traceroute google.com
&lt;/code>&lt;/pre>
&lt;h2 id="wget">&lt;strong>wget&lt;/strong>:&lt;/h2>
&lt;p>Direct download files from the internet.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ wget https://example.com/file.zip
&lt;/code>&lt;/pre>
&lt;h2 id="cal">&lt;strong>cal&lt;/strong>:&lt;/h2>
&lt;p>View a command-line calendar.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ cal
January 2023
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
&lt;/code>&lt;/pre>
&lt;h2 id="alias">&lt;strong>alias&lt;/strong>:&lt;/h2>
&lt;p>Create custom shortcuts for regularly used commands.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ alias ll='ls -l'
ubuntu@panda:~$ ll
total 4
drwxrwxr-x 2 ubuntu ubuntu 4096 Jan 1 12:00 clab
&lt;/code>&lt;/pre>
&lt;h2 id="whereis">&lt;strong>whereis&lt;/strong>:&lt;/h2>
&lt;p>Locate the binary, source, and manual pages for a command.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz
&lt;/code>&lt;/pre>
&lt;h2 id="whatis">&lt;strong>whatis&lt;/strong>:&lt;/h2>
&lt;p>Find what a command is used for.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ whatis ls
ls (1) - list directory contents
&lt;/code>&lt;/pre>
&lt;h2 id="top">&lt;strong>top&lt;/strong>:&lt;/h2>
&lt;p>View active processes live with their system usage.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ top
&lt;/code>&lt;/pre>
&lt;h2 id="useradd-and-usermod">&lt;strong>useradd&lt;/strong> and &lt;strong>usermod&lt;/strong>:&lt;/h2>
&lt;p>Add new user or change existing users&amp;rsquo; data.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ sudo useradd newuser
ubuntu@panda:~$ sudo usermod -aG sudo newuser
&lt;/code>&lt;/pre>
&lt;h2 id="passwd">&lt;strong>passwd&lt;/strong>:&lt;/h2>
&lt;p>Create or update passwords for existing users.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ sudo passwd newuser
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
&lt;/code>&lt;/pre>
&lt;h2 id="ls--1--wc--l">&lt;strong>ls -1 | wc -l&lt;/strong>:&lt;/h2>
&lt;p>Get the count of the files present in a directory.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ ls -1 | wc -l
12
&lt;/code>&lt;/pre>
&lt;h2 id="kill">&lt;strong>kill&lt;/strong>:&lt;/h2>
&lt;p>Command to kill a process (PID).&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ kill 1234
&lt;/code>&lt;/pre>
&lt;h2 id="w">&lt;strong>w&lt;/strong>:&lt;/h2>
&lt;p>Check how many users are logged into Linux.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ w
12:00:00 up 10 days, 2:00, 2 users, load average: 0.00, 0.01, 0.05
&lt;/code>&lt;/pre>
&lt;h2 id="date">&lt;strong>date&lt;/strong>:&lt;/h2>
&lt;p>Used to check the current date and time in Linux.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ date
Sat Jan 1 12:00:00 UTC 2023
&lt;/code>&lt;/pre>
&lt;h2 id="ls--a">&lt;strong>ls -a&lt;/strong>:&lt;/h2>
&lt;p>List the hidden files in a directory.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ ls -a
. .. .hiddenfile clab downloads
&lt;/code>&lt;/pre>
&lt;h2 id="ls--l">&lt;strong>ls -l&lt;/strong>:&lt;/h2>
&lt;p>Check the permissions on all the files.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ ls -l
total 4
drwxrwxr-x 2 ubuntu ubuntu 4096 Jan 1 12:00 clab
&lt;/code>&lt;/pre>
&lt;h2 id="ls--r">&lt;strong>ls -R&lt;/strong>:&lt;/h2>
&lt;p>List information about files and directories within the file system.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ ls -R
.:
clab downloads
./clab:
file1 file2
./downloads:
file3 file4
&lt;/code>&lt;/pre>
&lt;h2 id="rm--rf">&lt;strong>rm -rf&lt;/strong>:&lt;/h2>
&lt;p>Remove directory with the files.&lt;br>
Example:&lt;/p>
&lt;pre>&lt;code>ubuntu@panda:~$ rm -rf testdir
ubuntu@panda:~$ ls
clab downloads
&lt;/code>&lt;/pre></description></item><item><title>About me</title><link>http://lasthop.xyz/about-me/</link><pubDate>Sun, 06 Mar 2022 00:00:00 +0000</pubDate><guid>http://lasthop.xyz/about-me/</guid><description/></item><item><title>Archives</title><link>http://lasthop.xyz/archives/</link><pubDate>Sun, 06 Mar 2022 00:00:00 +0000</pubDate><guid>http://lasthop.xyz/archives/</guid><description/></item><item><title>Search</title><link>http://lasthop.xyz/search/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://lasthop.xyz/search/</guid><description/></item><item><title>Useful links</title><link>http://lasthop.xyz/useful-links/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://lasthop.xyz/useful-links/</guid><description/></item></channel></rss>