More

Every Day Linux Commands

The majority of the web servers run on Linux. If you are a backend developer or dealing with web development or web hosting Linux skills are essential. Linux is ideal for backend development.
It is quick, trustworthy, and secure. As a backend developer, there are many reasons to have Linux skills. Linux is a very stable OS and you do not have to worry about random crashes or data loss and your development experience and process will be much smoother.

Linux is incredibly safe as well, this is crucial since your backend servers deal with sensitive data. Linux is quite adaptable you can configure it according to your development needs which makes it an ideal candidate OS for backend development. I am sharing some of the common Linux commands that are used most frequently on a day-to-day job and if you are new to backed development and Linux environment you can use this as a starting point of your Linux journey.

File System Commands

CommandDescription
ls This command gives information about files
ls -l or llThis command privies the file information in a long listing format.
ls -la or laThis command lists file information in a long listing format including system files as well as hidden files (files starting with .)
cd or cd ~This command changes the directory to the user’s home directory.
pwdThis command displays the present working directory.
cd <directory name>This command helps you to navigate from one directory to another directory.
cd ..This command moves the user to the parent directory.
mkdir projectThis command will create a new directory called project on the current location.
rmdir project Deletes empty directory project.
touch hello.txtThis will create a new empty file hello.txt at the current location.
cat hello.txtThis command will echo the contents of the hello.txt file on the screen.
cat > hello.txtThis command will open the hello.txt file in input mode. you can start typing the contents you want to save into the file. Once you are done typing press control or command + z to save the file and return to the prompt
cat >> hello.txtOpens hello.txt file in append mode.
tail hello.txtThis command will print the last 10 lines of the file hello.txt
less hello.txtThis command print contact of hello.txt files in backward movement.
cp hello.txt hi.txtThis command creates a copy of the hello.txt file with the name hi.txt
mv hi.txt hey.txtThis command renames the hi.txt file to the hey.txt file. the mv command is also used to move files from one place to another place all you have to do is add the full path of the destination for example mv hi.txt /home/jhon/hey.txt
rm hi.txtDeletes the file hi.txt
rm -f projectRemoved project directory
rm -r projectRemove the project and its contents recursively

Network Related Commands

CommandDescription
ping 127.0.0.1Pings IP 127.0.0.1. Ping is used to troubleshoot/check the status of connectivity.
whois google.comDisplays information about google.com
dig google.comDisplays DNS information about google.com
dig -x google.com Checking reverse DNS lookup on google.com
wget ULR_OF_FILEDownload the file from the web
wget -c ULR_OF_FILEContinue partially downloaded files. It is useful when you have an unfinished download of a file.
wget -r ULRDownload files recursively from the given URL. It is useful when you have multiple files to download. The default maximum recursion depth is 5.
curl URLTransfers/Outputs data from the given URL
curl -o hi.txt URLWrite data to hi.txt from data received from ULR instead of displaying it on stdout.
ssh jhon@127.0.0.1Connects remote machine 127.0.0.1 as user jhon.
ssh -p 22 jhon@127.0.0.1Connects to 127.0.0.1 as Jhon on port 22.
ssh -i <path-to-key> jhon@127.0.0.1Connects to 127.0.0.1 as user Jhon using the given private key

Process Related Command

CommandDescription
psDisplays information about active processes.
ps -p 2094Displays information about the process which has pid 2094
ps -e or ps auxDisplay every process on the system
kill 2094Kill process which has pid 2094
topProvides dynamic run time view of running system
htopIt’s an interactive process viewer. It is more details and interactive tool compared to top

System Information Commands

CommandDescription
datePrint system date and time.
uptimeShows how long the system has been running.
whoamiPrints effective/current user name.
whoGives a list of all logged-in users.
freeDisplay the amount of free and used memory in the system.
duDisplays space usage from directories and files.
dfGives report of the file system/disk usage.
cat /proc/cpuinfoDisplay information related to CPU
cat /proc/meminfoDisplay information related to memory
whichGives full path of executable. For example which PHP will give you the full path for installed php executable

The above-given commands are some of the commands that you will use on daily bases if you are using a Linux system. This list of commands will get you started with your Linux journey. Linux OS is well documented, if you need any help with any command just type –help at the end of the command or prefix command with man and it will give you a complete documentation for the given command. For example if you need help with ls command just type ls –help or man ls and you will get detailed documentation for the ls command. Linux is very essential skill for a developer and with constant practice you can master it.

N
T