|
1 |
| -WIP |
| 1 | +- `whereis` - Find the path of that executable file. |
| 2 | + |
| 3 | +### List operation |
| 4 | +- `ls` - Shows list. |
| 5 | + - `-a` - Hidden file. |
| 6 | + - `-l` - Persmission. |
| 7 | + - `-R` - Show sub dir. |
| 8 | + |
| 9 | +### Changing dir operation |
| 10 | +- `cd <folder-name>` - Change Dir. |
| 11 | +- `cd ..` - Go one Directory back. |
| 12 | +- `cd` - Go to home. |
| 13 | +- `cd ../<foldername>` - Open a previous dir folder. |
| 14 | +- `cd <path>` - Open a dir with the path. |
| 15 | + |
| 16 | +### File/Folder Ope. |
| 17 | +- `mkdir <new-dir-name>` - Create a new folder. |
| 18 | +- `mkdir -p test/test1/test2` - Craete a dir between two directories. |
| 19 | +- `touch <new-file-name>` - create a blank file. |
| 20 | +- `pwd` - Present working directory. |
| 21 | +- `cat <filename>` - Display file content. |
| 22 | +- `cat > <new-file-name>` - Create a file. |
| 23 | +- `cat >> <filename>` - Append the file. |
| 24 | +- `cat <filename> <filename2> ` - Display 2 files at a time. |
| 25 | +- `cat <filename> <filename2> > <newfile-name>` - Merge both of file content in a single one. |
| 26 | +- `cat <file-name> | tr > <new-file-name>` - Translate the file. |
| 27 | +- `cut -c 1-2 <filename>` - cut the file with colum wise |
| 28 | +- `echo "Hello" >> <file-name>` |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | ++ |
| 34 | +### |
| 35 | +- `man <commad name>` - Know about the command usages and options. |
| 36 | +- `man <commad name>` - know about the command. |
| 37 | + |
| 38 | +### File/Folder operation |
| 39 | +- `cp <file-name> <new-fie-name>` - Make a copy of a file in the current location. |
| 40 | +- `mv <file-name> <dir-path>` - Move a file from a one dir to a another. |
| 41 | +- `mv <file-name> <new-fie-name>` - Rename a file. |
| 42 | +- `mv -R <dir-name> <dir-path>` - Move Dir |
| 43 | +- `rm <file-name>` - Remove a file |
| 44 | +- `rm -R <file-name>` - Delete a folder with dir included. |
| 45 | +- `head <file-name>` - Will display first 10 lines of a file. |
| 46 | +- `tail <file-name>` - Will display last 10 lines of a file. |
| 47 | + -`-n 2` - will display last 2 lines. |
| 48 | +- `diff <file-1> <file-2>` - Show diff between the two files. |
| 49 | +- `locate <file>` - To find out the file. |
| 50 | +- `find <file/folder-name>` - Find a file/folder. |
| 51 | +- `find <dir-name>` - Find files inside the dir |
| 52 | +- `find .-type d` - Show only dir. |
| 53 | + - `.-type f` -Sshow only files. |
| 54 | + - `.-type f -name "*.txt"` - Show only files with that specfic name. |
| 55 | + - `.-type f -iname "*.txt"` - Show only files with that specfic name - not case sentive (i) |
| 56 | + - `.-type f -mmin -20` - Show files which modify less than 20 min ago. |
| 57 | + - `.-type f -mmin +20` - show files which modify more than 20 min ago. |
| 58 | + - `.-type f -maxdepth 2` - Will only show 1 folder deep. |
| 59 | + - `.-size +1k` - will only show file/folder with size of 1kb |
| 60 | + |
| 61 | + |
| 62 | +### System commands |
| 63 | +- `ps aux` - processes which are running |
| 64 | +- `df` - Check the capacity and storage details. |
| 65 | + - `m` - In megabyte) or |
| 66 | + - `hg` - (gigabyte). |
| 67 | +- `du` - Disk usages capcity |
| 68 | + - `-h` (human readable) |
| 69 | +- `echo` - Get a output of a string |
| 70 | +- `echo $PATH` - Check the path varibale |
| 71 | +- `sudo` - Admin command |
| 72 | +- `sudo chown root text.txt` - chnage owner |
| 73 | +- `!<command-name>` - Run the pevious command |
| 74 | +- `git add .; git commit -m "message"` - Run mutiple commands at a time |
| 75 | +- `sort <file-name>"` - sort the file |
| 76 | +- `job` |
| 77 | +- `wget <url>` - download the file from the URL |
| 78 | +- `top` - what processes are running |
| 79 | +- `kill <process-id>` -stop that process |
| 80 | +- `Uname` - |
| 81 | +- `zip <file-1> <file-2>` - Zip Two or more files |
| 82 | +- `Unzip <file-name>` - Unzip files |
| 83 | +- `useradd <name>` |
| 84 | +- `passwd <name>` |
| 85 | +- `uname -<flag>` -o -m -r |
| 86 | +- `lscpu` - get cpu details |
| 87 | +- `free` - free memory |
| 88 | +- `vmstat` - virtual memory |
| 89 | +- `lsof` - list all the open file |
| 90 | +- `xdg-open <file-fath>` - open the folder (graphical window) of a file/folder with path. |
| 91 | +- `xdg-open .` - open the folder of the current directory. |
| 92 | +- `vi ~/.bashrc` - set your Alias |
| 93 | +- `echo -n 'username' | base64` |
| 94 | + |
| 95 | +### Networking |
| 96 | +- `nslookup google.com` |
| 97 | +- `netstat` - |
| 98 | +- `hostname` - |
| 99 | +- `whoami` - |
| 100 | +- `ping google.com` |
| 101 | + |
| 102 | + |
| 103 | +### Permissions |
| 104 | +- `chmod u=rwx,g=rxw,o=rwx <file-name>` READ, WRITE AND EXECUTE |
| 105 | +- `chmod 777 <file-name>` - 4- Read, 2- Write, 1 - Execute |
| 106 | +- `find . -perm 777 ` - will only show file/folder with size of 1kb |
| 107 | +- `grep <keyword> <file-name>` - To search if the keyword is presnt in the file or not |
| 108 | +- `grep -w <keyword> <file-name>` - To search if the keyword is presnt in the file or not (complete word) |
| 109 | +- `grep -i <keyword> <file-name>` - To search if the keyword is presnt in the file or not (not case sens) |
| 110 | +- `grep -n <keyword> <file-name>` - To search if the keyword is presnt in the file or not (Line number) |
| 111 | +- `grep -B <keyword> <file-name>` - Show Line before that keyword |
| 112 | +- `grep -win <keyword> ./*.txt` - To search if the keyword is presnt in the file in current dir |
| 113 | +- `grep -win -r <keyword> .*` |
| 114 | +- `history | grep "ls -l"` - Pipping, we filter out the things |
| 115 | + |
| 116 | +``` |
| 117 | +histroy |
| 118 | +!<number-from-history> |
| 119 | +``` |
| 120 | + |
| 121 | +# Operators |
| 122 | + |
| 123 | +- `ping google.com & pingfacebook.com` |
| 124 | +- `echo "google.com" && echo "facebook.com"` - second will oly run if first is sucessful |
| 125 | +- `echo "google.com" && {echo "facebook.com"; eco "pradumnasaraf.co"}` |
| 126 | +- `echo "google.com" || echo "pingfacebook.com"` |
| 127 | +- `echo "google.com" || echo "pingfacebook.com"` |
| 128 | +- `rm -r !(file.txt)` |
| 129 | + |
| 130 | +- `printevnv` - to print all th env. |
0 commit comments