# Linux Commandus

**`echo o/p`** any text

**`whoami`** find user

ls listing ls-a // ls-all hidden files ls -l informative format ls -al mixed ls \*.txt show all ended by ".txt" ls a?.txt just one char ls a\[0:9] range of char cd change direction

**`cat`** show output the files / open the files less show full scren \_then =="enter"

**`pwd`** where am i "/home/folder"

**`find`** -name \*.txt find the files find . -name \*.txt find the files in the current dir

**`grep`** "the word" file. search for a word in file (highlighted)

**`&`** run commands in the background

**`&&`** two commands

> ```
>               redirect to another file
> ```

> > ```
> >              thesame > (overwritten)    
> > ```

**`touch`** create file

**`mkdir`** create folder

**`cp`** copy

**`mv`** move/cut

**`rm / -R`** remove (directory)

file find the type of a file

**`su -l`** switch users

**`wget + link`** download link

**`head -n`** + filname print first n lines head -f + filname print last n lines with peiniting the go-on text

**`ps aux`** all services

**`lsof -i`** open files for internet

**`netstat -antp`** network connection

**`ifconfig`** information

sort + fliename sort file uniq (sort must) rm dublicate sort a.txt | uniq output of sort is input for uniq

**`passwd`** change pass

**`find /`** find in all (root)

**`ctrl + c`** terminate

ln creat link file (shortcut)

; two command whatever

&& two commands (in case first command run)

|| two commands (in case first command fail)

env info of the environment

which + name where this file is

useradd passwd userdel groupadd passwd groupdel gpasswd -a (username) (groupname)

shadwo / passwd passwords of all

**`su -`** switch root su username switch user su username -c command execute one command in username without switch sudo run as root

service start/stop/restart/print status/enable-disable

/ root every thing is here

/bin user binaries (ls.,cp) /sbin sudo commands

/etc sys configs

/usr progrms downloaded

chmod (u,g,o,a) + (rwx) fileName change permission chmod 777 (u=7,g=7,o=7) filename (r=4,write=2,exe=1)

### install software 1)apt-get update /\ apt-get update && apt-get upgrade 2)apt-get install (name) -i :install -r :remove

passwd , shadow : stores passwords format sha512

-rwx-rwx-rwx : owner,groups,users read,write,execute

SSH:protocol to connect devices within internet (encrypted)

/etc important directory /var database /root home directory /tmp temporary files

**`nano`** \[text editor] **VIM** \[advanced editor]

systemctl stop/enaple "service name"

whois + domain name

nslookup -type=a,aaaa (ipv4,ipv6) dig + domain name <https://dnsdumpster.com/> <https://tryhackme.com/room/shodan>

**`tool -h`** \[help] if there is this tool in system
