"Maximizing DevOps Efficiency with Linux"

Linux Cheat Sheet:

Linux is an open-source UNIX-like operating system (OS). An operating system is a software that directly manages a system’s hardware and resources, like CPU, memory, and storage.OS acts as a GUI through which user can communicate with the computer. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.

1.File and Directory Operation Commands

  • ls : List Files and directories

  • ls-l : Long format Listing with detailed information

  • ls -a : shows all files and directories includes hidden

  • ls -lh :Displays file sizes in Human readable format

  • cd : Change directory to specified path

  • pwd : Displays the present working Directory

  • mkdir : create new directory (folder)

  • rmdir dir_1:Deletes the directory with name "dir_1"

  • touch A : Create an empty file with name "A"

  • rm : Removes files and directories

  • rm file1 : Delete a file with name File1

  • rm -r dir_1: deletes the directory “dir_1” and its contents

  • rm -f file1:forcefully deletes the file “file1” without confirmation.

  • cp A B :copies data form source file "A" to destination file "B"

  • mv A dir_1 : Moves file A to dir_1

  • cat A :displays the contents in file A

  • head A : displays the first ten lines in File A

  • tail A : displays the last ten lines in File A

2. File Permissions

  • chmod : Used to change file Permissions u - user /owner g - group o - other

  • chmod u+rwx : grants read write and execute permissions to the user

3.Process Management Commands :

  • ps :display Running Processes

  • ps -aux : Show all processes

  • kill : terminate a process

  • grep :used to search for specific patterns or regular expressions in text files or streams and display matching lines.

  • grep -i "hello" file.txt: we are extracting our desired output(hello) from filename (file.txt)-i: Ignore case distinctions while searching.-v: Invert the match, displaying non-matching lines.-r or -R: Recursively search directories for matching patterns.-l: Print only the names of files containing matches.-n: Display line numbers alongside matching lines.-w: Match whole words only, rather than partial matches.-c: Count the number of matching lines instead of displaying them.-e: Specify multiple patterns to search for.-A: Display lines after the matching line.-B: Display lines before the matching line.-C: Display lines both before and after the matching line.

4.System Information Commands :

  • uname : Print system information.

  • uname -a : displays all system information.

  • whoami : Display current username.

  • df : Show disk space usage.

  • df -h : displays disk space usage in a human-readable format.

  • free : Display memory usage information.

  • free -h displays memory usage in a human-readable format.

  • uptime : Show system uptime.

5.Networking Commands :

  • ifconfig : shows the details of all network interfaces.

  • ping : Send ICMP echo requests to a host.

  • ping google.com :sends ICMP echo requests to “google.com” to check connectivity.

  • wget : Download files from the web.

  • curl : Transfer data to or from a server.

  • curl : http://example.com retrieves the content of a webpage from the specified URL.

0
Subscribe to my newsletter

Read articles from vinai chowdary kolluri directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

vinai chowdary kolluri
vinai chowdary kolluri