20 Linux Commands to learn for your career as a Systems/Cloud Administrator
Linux Commands:
1. Curl = transfers urls to test application connectivity – remember the last time you got a HTTP 500 error? This means that your request to the page can’t reach a database. So what could be the problem? We can use curl to check if our application can get to other places besides the database, and that’s where we would use curl. From here we can see if it can look into the nameserver to see why the database isn’t resolving to the hostname
2. Python –m json.tool /jq = sometimes the curl command gives you a block of text that is difficult to read ; so we can use python to convert the output into json format so I can read it easier.
3. Ls = list
4. Tail = lists last part of file
5. Head = lists first part of file
6. Cat = concatenate = checking the contents of a file or confirm an app version
7. Grep = searches file patterns. If im looking for a specific pattern in the output of another command, grep highlights the relevant lines that im looking for.
8. Ps = shows process IDs and status’s of running processes
9. Env = if an application isn’t starting you can use the environment variables command to check if there are any wrong environment variables that are preventing the application from starting. These variables can be versions, database path, location of files, the name of the database
10. Top = like the task manager in windows – monitoring tool. Sometimes we get a memory error – and we can go into top to check – is it really out of memory?
11. Netstat = shows the network status. Its like a routing table, it shows us the network ports in use and their incoming connections. However, on a router like a 2911 cisco you already have routing tables on the IOS. Whereas on Linux, Netstat doesn’t come with linux by default. So if you want this feature on your Linux machines, you can install it on your VMs, or since we are a DevOps culture – a culture that holds a high value for automation so that we are productive instead of busy, you can add a script into Azure or AWS when spinning up Ubuntu VMs to have them provision with Netstat installed.
12. Ip = ip address show eth0 = show the ip information of a network interface
13. Isof = lists the open files associated with an application, and more importantly can check for listening ports. So what does that mean, if you want to check if port 80 is in use, you use isof to check which process ID is using it.
14. Df = display free disk space
15. Du = retrieve detailed information about which files use the disk space in a directory. You can use this to see which files use the most space
16. Id = check the users running applications – can only run properly as superuser
17. Chmod = as a superuser you can change permissions and execution rights on files
18. Dig /nslookup = name server lookup = DIG = DNS lookup utility
19. Firewall-cmd = sudo firewall – close ports and open ports – if we wanted to enable ssh on a centos VM, we would have to use the firewall command to open up port 22
20. History = shows the history of commands used since the start of your session
Join my discord channel:
https://discord.gg/A8AZ6Uf
Add me on LinkedIn:
https://www.linkedin.com/in/adam-marton-beke-06505425a/