Skip to content

13 Linux Commands Every Engineer Should Know

uname operative system

sh
uname
#Linux

pwd current directory

sh
pwd
#/home/userName

cd change directory

sh
cd /etc
#username@server: /etc$

ls list directory

flags:

sh
    -l  list directory with all information
    #drwxr-xr-x  2 root root     4096 Apr 26 00:00 backups
    #drwxr-xr-x 23 root root     4096 Apr 22 07:55 cache

cat visualize content file

sh
cat file.name
#Lorem ipsum dolor sit amet, esse cupidatat ipsum ea. 
#Adipisicing officia dolore aliquip incididunt ea adipisicing officia laboris incididunt veniam consectetur.

| "Pipe" command is used to pass the output of one command as input to another


grep filter, stands for Global Regular Expression Print

sh
cat file.name | grep textInSide
cat file.name | grep textInSide > resultSaveInFileName

wc word count command

sh
flags:
    -l  count lines
    -w  count words
    -c  count bytes
    -m  count characters
    -L  find longest line length

cp copy file to

sh
cp file.name file.name.copy

find used to search for files and directories in directory hierarchy

sh
    .   current directory
    /   root file system

        ex: find / -name "*.conf"
        ex: find / -name "*.conf" | grep db     that have db in it

diff difference between two files

sh
    ex: diff file.name file.name.bk

curl stands for Client URL

sh
    "used to transfer data from or to a server
    using various protocols like HTTP, FTP 
    commonly used for interacting with APISs 
    and debugging networking requests"

	ex: curl https://google.com

chmod change permissions on file access


root change to root

sh
sudo su -
sudo -i
#root@serverName:~#