Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1e339df

Browse files
Restructure and update grep awk sed
1 parent 158e3e5 commit 1e339df

File tree

1 file changed

+49
-35
lines changed

1 file changed

+49
-35
lines changed

‎README.md

Lines changed: 49 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,22 @@ Handy list of oft-used Linux commands that I will never remember. Not intended t
77
- [Count number of items in directory](#count-number-of-items-in-directory)
88
- [Monitor GPU usage](#monitor-gpu-usage)
99
- [File Permissions](#file-permissions)
10-
- [SSH 101](#ssh-101)
11-
- [rsync](#rsync)
12-
- [Networking](#networking)
1310
- [fish](#fish)
1411
- [wget](#wget)
15-
- [grep](#grep)
12+
- [Networking](#networking)
13+
- [Port Monitoring](#port-monitoring)
14+
- [SSH 101](#ssh-101)
15+
- [rsync](#rsync)
1616
- [System Setup](#system-setup)
1717
- [Essential Installs in Ubuntu LTS Minimal](#essential-installs)
1818
- [Increasing swap memory](#increasing-swap)
1919
- [Session management using screen](#session-management-using-screen)
2020
- [Docker 101](#docker-101)
2121
- [Git 101](#git-101)
2222
- [make Basics](#make-basics)
23+
- [Data Wrangling](#data-wrangling)
24+
- [grep](#grep)
25+
- [awk and sed](#awk-and-sed)
2326

2427
## Shell 101
2528

@@ -62,32 +65,28 @@ sudo chmod XXX <filepath>
6265
# ssh directory 700
6366
```
6467

65-
### SSH 101
68+
### fish
6669

6770
```bash
68-
# connect to hostname with key and port forward
69-
ssh -L <remote_port>:localhost:<local_port> -i /path/to/key username@hostname
71+
# Set password of user account on GCP VM
72+
sudo passwd $USER
73+
# set fish as default shell
74+
chsh -s `which fish`
7075
```
7176

72-
### rsync
77+
### wget
7378

7479
```bash
75-
# -avzPn --stats -h --> archive verbose compressed progress-bar dry-run human-readable-stats
76-
77-
# pull files from remote server
78-
79-
rsync -avzPn --stats -h username@remote_host:/home/username/directory_we_want ~/local/directory
80-
81-
# push files to remote
82-
rsync -avzPn ~/local/directory username@remote_host:/home/username/destination_dir
83-
84-
# using ssh key
85-
rsync -avzPn -e "ssh -i ~/ec2_keyfile.pem" user@remote:/home/folder /tmp/local_system/
80+
# recursive no-parent Reject no-Host robots.txt X_no_of_dirs
81+
wget -r -np -R "index.html" -nH -e robots=off --cut-dirs=X <download_URL>
8682
```
8783

88-
More details on [rsync cheatsheet](https://www.danielms.site/blog/rsync-cheatsheet/)
84+
* Nifty recipes for common commands - [tldr.sh](https://tldr.sh/)
85+
* Some basic shell usage [examples](https://missing.csail.mit.edu/2020/shell-tools/)
8986

90-
### Networking
87+
## Networking
88+
89+
### Port Monitoring
9190

9291
```bash
9392
# Get PID of a process running on port YYYY
@@ -96,29 +95,30 @@ sudo netstat -lpn | grep :YYYY
9695
fuser 8080/tcp (add -k to kill the process too)
9796
```
9897

99-
### fish
98+
### SSH 101
10099

101100
```bash
102-
# Set password of user account on GCP VM
103-
sudo passwd $USER
104-
# set fish as default shell
105-
chsh -s `which fish`
101+
# connect to hostname with key and port forward
102+
ssh -L <remote_port>:localhost:<local_port> -i /path/to/key username@hostname
106103
```
107104

108-
### wget
105+
### rsync
109106

110107
```bash
111-
# recursive no-parent Reject no-Host robots.txt X_no_of_dirs
112-
wget -r -np -R "index.html" -nH -e robots=off --cut-dirs=X <download_URL>
113-
```
108+
# -avzPn --stats -h --> archive verbose compressed progress-bar dry-run human-readable-stats
114109

115-
### grep
110+
# pull files from remote server
116111

117-
```bash
118-
# find pattern in files
119-
grep --include=\*.{py, c, h} --exclude=\*.o --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"
112+
rsync -avzPn --stats -h username@remote_host:/home/username/directory_we_want ~/local/directory
113+
114+
# push files to remote
115+
rsync -avzPn ~/local/directory username@remote_host:/home/username/destination_dir
116+
117+
# using ssh key
118+
rsync -avzPn -e "ssh -i ~/ec2_keyfile.pem" user@remote:/home/folder /tmp/local_system/
120119
```
121-
More `grep` funda [here](https://www.grymoire.com/Unix/Grep.html)
120+
121+
More details on [rsync cheatsheet](https://www.danielms.site/blog/rsync-cheatsheet/)
122122

123123
## System Setup
124124
### Essential Installs
@@ -277,3 +277,17 @@ dep%: subdep1 subdep2
277277
```
278278
* [Metaprogamming - MIT Missing Semester](https://missing.csail.mit.edu/2020/metaprogramming/)
279279
* [`make` Standard Targets](https://www.gnu.org/software/make/manual/html_node/Standard-Targets.html#Standard-Targets)
280+
281+
## Data Wrangling
282+
283+
### grep
284+
285+
```bash
286+
# find pattern in files
287+
grep --include=\*.{py, c, h} --exclude=\*.o --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"
288+
```
289+
More `grep` funda [here](https://www.grymoire.com/Unix/Grep.html)
290+
291+
### awk and sed
292+
293+
TODO: Refer [here](https://missing.csail.mit.edu/2020/data-wrangling/) now

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /