-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.txt
101 lines (86 loc) · 2.73 KB
/
commands.txt
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
C-r search bash history
Run - c-z,fg > Stopped - c-z,bg > Run background - c-c > End
C-l clear, C-w delete word, A-f/b Move forward/backward a word, C-a/e Start end of the line
!l -run last command starting with l in bash history
mplayer !$ - run a command with the last argument of the last command
?player single character, linux globbing
grep -v -i -r -F
chmod ugo+rwx
user, group, owner are often the same on linux
r:4 w:2 x:1, 777 is all permissions for all
type ,find out if command exists,
which ,to get path of non-shell command
pgrep, pkill, pstree
killall firefox
echo `date`
ps -aux
dpkg -L packagename -Find out what the command is to run a new package
apt-cache search
apt-cache depends packagename
aptitude is a more advanced version of apt, it installs recommended packages as well (better for me!)
it also includes all the commands in one, and cleans up after itself
Ubuntu aptitude survival guide
echo $PATH | tr ":" \n"
tr "abc" "123"
tr will replace regex groups with single chars
du -sh * | sort -rh | head -11
sort | uniq -c
split -b 75m input.txt
for i in *.JPG; do mv "$i" "${i/.JPG}.jpg; done
find . -iname "*.png" -print0 | xargs -o du -ch | tail -1
pgrep -l
kill USR1 4125
watch -n 10 kill -USR1 4125
hexdump -C
rename
mplayer -vo xv -ao sdl -lavdopts fast:skiploopfilter=all -framedrop
sudo update-alternatives --config x-www-browser
tar -xzf
ls
-t : time
-r : reverse
-v : version
-S : size
-R : Recursive
-X : extension
to add scripts to 'nix
add #!/bin/bash to the top of the file
chmod +x script eXecutable permissions
export PATH=$PATH:$HOME/bin
jobs, top, ps
command &, ^z, fg, bg %jobnumber
surf google.co.nz </dev/null &>/dev/null &
nohup:output to file, disown:Will still use stdout
vim - : reads from stdin
vim -O $(find . -name '*.c')
:!perl -c % //% refers to the current buffer
:shell
vimdiff
You can call any text processing or VC commands from inside Vim
You can integrate warnings with the jumplist
find
-ls : l
-(i)name
-(i)path
-mtime +/-5(days)
-newer filename.py
-type d/f/l :directories,files or symlinks
-exec : ran a command on the commandline
-delete
-print0 makes the record separator a null char, need to add -0 to xargs
sort h r n f
xargs
multiline input | xargs command to add input as a command to
grep:find files based on their contents
-R
file : gives metadata on a file
df
file >> "text" add line to the end of a file
fdisk -l to find out what you can mount
Connected -> mounted -> unmounted -> ejected
mount show currently mounted things
umount unmount something
fdisk /dev/sdb interactive dialog for creating patitions
mkfs.SOMEFILESYSTEM /dev/sdb1 will format the partition with a certain file system
A disk is split in to 0(no partition table)-n partitions, each of which has a file system
amixer set Master 100%