sort -n|--numeric-sort foo.txt # Sort numbers instead of strings
sort -t|--field-separator: -k 3n /foo/foo.txt # Sort by the third column of a file
```
[⬆ ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ](#contents)
## File Permissions
| # | Permission | rwx | Binary |
@ -3400,7 +3412,11 @@ sed 's/fox/bear/g' foo.txt # Replace fox with bear in foo.txt and
@@ -3400,7 +3412,11 @@ sed 's/fox/bear/g' foo.txt # Replace fox with bear in foo.txt and
sed 's/fox/bear/gi' foo.txt # Replace fox (case insensitive) with bear in foo.txt and output to console
sed 's/red fox/blue bear/g' foo.txt # Replace red with blue and fox with bear in foo.txt and output to console
sed 's/fox/bear/g' foo.txt > bar.txt # Replace fox with bear in foo.txt and save in bar.txt
sed 's/fox/bear/g' foo.txt -i|--in-place # Replace fox with bear and overwrite foo.txt
sed -i|--in-place 's/fox/bear/g' foo.txt # Replace fox with bear and overwrite foo.txt
sed -i|--in-place '/red fox/i\blue bear' foo.txt # Insert blue bear before red fox and overwrite foo.txt
sed -i|--in-place '/red fox/a\blue bear' foo.txt # Insert blue bear after red fox and overwrite foo.txt
sed -i|--in-place '10s/find/replace/' foo.txt # Replace the 10th line of the file
sed -i|--in-place '10,20s/find/replace/' foo.txt # Replace in the file 10-20 lines
```
[⬆ ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ](#contents)
@ -3743,6 +3759,7 @@ screen -ls # List all sessions
@@ -3743,6 +3759,7 @@ screen -ls # List all sessions
screen -R 31166 # Reattach to a session
exit # Exit a session
reset # Reset the terminal(when binary and the terminal state is messed up)
```
[⬆ ʀᴇᴛᴜʀɴ ᴛᴏ ᴄᴏɴᴛᴇɴᴛꜱ](#contents)
@ -4183,6 +4200,8 @@ Inspired by <a href="https://github.com/RehanSaeed/Bash-Cheat-Sheet">RehanSaeed/
@@ -4183,6 +4200,8 @@ Inspired by <a href="https://github.com/RehanSaeed/Bash-Cheat-Sheet">RehanSaeed/
| Ctrl+s | Suspend |
| Ctrl+q | Resume |
| Ctrl+d | Log out from a shell (similar to exit) |
| Ctrl+/ | Undo changes in command-line|
Ctrl+x(twice)| The cursor jumps back and forth between the current position or the beginning of the line |
| | |
| | |
| | |
@ -4192,16 +4211,19 @@ Inspired by <a href="https://github.com/RehanSaeed/Bash-Cheat-Sheet">RehanSaeed/
@@ -4192,16 +4211,19 @@ Inspired by <a href="https://github.com/RehanSaeed/Bash-Cheat-Sheet">RehanSaeed/
| Alt+t | Reverses the position of the word the cursor is in with the previous word |
| Alt+u | Capitalizes every character from cursor left to right to the end of one word |
| Alt+l | UnCapitalizes every character from cursor left to right to the end of one word |
| Alt+r | Reverts any changes to a previously executed command that is edited |
| Alt+r | Reverts any changes to a previously executed command that's being edited |
| Alt+. | Fetch and paste the last word at end of a command from previous commands |
</p>
</details>
---
### Online Cheat Sheet :feelsgood: for quick references of commands and codes
## Online Cheat Sheet :feelsgood: for quick references of commands and codes