https://github.com/mraza007/til
Things I learn/discover on daily basis.
https://github.com/mraza007/til
linux programming til
Last synced: 2 months ago
JSON representation
Things I learn/discover on daily basis.
- Host: GitHub
- URL: https://github.com/mraza007/til
- Owner: mraza007
- Created: 2021-02-03T03:01:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T01:45:21.000Z (almost 4 years ago)
- Last Synced: 2025-03-25T20:05:57.815Z (3 months ago)
- Topics: linux, programming, til
- Language: HTML
- Homepage: https://til-mraza007.vercel.app
- Size: 1.14 MB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TIL (Things I discover Linux/Programming/Automation)
# Linux
xargs -n 1 curl -sL < 2018.txt | grep -Eo ".*" The command to extract links using curl
curl -sL https://news.ycombinator.com/item\?id\=18740939 | grep -Eo 'href="(https|http):[^\"]+"' Command to extract the links from hackernews
grep -aEo ".*" -a option process binary file [link to sol](https://unix.stackexchange.com/questions/335716/grep-returns-binary-file-standard-input-matches-when-trying-to-find-a-string)
use ``` backticks to run a command in bash-
- We can use this command to generate a `grub` configuration file, `sudo grub-mkconfig -o /boot/grub/grub.cfg`,As, `grub-mkconfig` scans hardrives for bootable operating systems such as windows,mac or linux distros
- To open workspaces on specific windows when using `i3` window mananger use the following `assign [class=""] $workspace` and refresh `i3-msg reload`
- In order to resize images using command you can use the `convert` command.
`convert img.jpg -resize 200x200 img-1.jpg` and you can also convert to different extenstions using `convert` command. `convert img.png img.jpg`- To add a printer on linux use `CUPS` web admin `http://localhost:631/`
- `fuser -k /tcp` use `fuser` to kill specific ports on linux
- In order to save a file with root permission using vim you can do
`:w !sudo tee %`- This commands `sudo netstat -plunt |grep post` outputs the port on which postgres db is running on
- `chmod -x` allows you to revert the executable created by `chmod +x`
- you can use `?*` to match the rest of the characters when moving the files
## Git
In order to delete a branch on git locally you can use
`git branch --delete ` and if you want to do it remotely you can do `git push --delete `To delete git commit history do the following
- `git checkout --orphan `
- `git add -A`
- `git commit --all -m "a message"`
- `git branch -D `
- `git branch -m `
- `git push -f origin `## Python
jinja line break
`{% autoescape false %} {{ org.backgroundInfo | replace(‘\n’, ‘
’) }} {% endautoescape %}`