-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashcommands.py
executable file
·63 lines (44 loc) · 1.38 KB
/
bashcommands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python
# print bash commands
print """
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxx Commands I often forget xxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--- file without file ending ---
for i in *.end; do echo ${i%\.*}; done
--- list content in tar.gz file ---
tar -ztvf file.tar.gz
--- extract specific file ---
tar --extract --file=file.tar.gz filename
--- add line after line ---
sed '/patternstring/ a\\
new line string' file1
--- replace only the first occurence in a file ---
sed '0,/replace/{s/replace/new_string/}' file
--- number of lines in a directory ---
ls -1 targetdir | wc -l
--- stdout and stderr during run is ---
--- located on the running node in ---
/var/spool/torque/spool/
xxxxxxxxxxxxxxxxxxxx
xxx git commands xxx
xxxxxxxxxxxxxxxxxxxx
git bisect start
git bisect bad
git bisect good
git bisect reset
--- merge with one new commit instead of merge commit ---
git co master; git merge --squash --ff tmp_branch
--- only show the commits directly to this branch ---
git log --first-parent
--- create new branch ---
git push origin <new_branch>
--- delete branch remotely ---
git push origin --delete <branch-name>
--- if submodules has been moved ---
git submodule sync
--- rewrite last (unpushed) commit message ---
git commit --amend
"""
print "find . -type f -print0 | xargs -0 sed -i -c 's/\-lt/\-ne/g'"
print "sh -x 2013-05-28T*/*.check 2013-05-28T*/*.log"