forked from candyan/code_snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash.txt
103 lines (103 loc) · 5.89 KB
/
bash.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
102
103
vimtutor
pacman -S <package> # install package
pacman -S --force <package> # force upgrade package
pacman -Rs <package> # remove package
pacman -Syu # upgrade system
pacman -Syyu # update package list
cryptsetup luksOpen /dev/sdb2 fedora_khaleesi-home
mount /dev/mapper/fedora_khaleesi-home /media/fedora_khaleesi-home
awk '$1 ~ /^Line:/ {print $2}' <file>
awk 'BEGIN{print ENVIRON["X"], ENVIRON["TERM"]}'
lt --port 80 --subdomain myubuntu # access the local web server from https://myubuntu.localtunnel.me
youtube-dl -F <url> # list all available formats for a specific video
youtube-dl -f=<format code> <url> # download the video in a specific format
youtube-dl -f bestaudio -x <url> # download only audio
youtube-dl -f bestaudio[<format>] -x <url> # download only audio in a specific format
mount -t ntfs-3g -o remove_hiberfile /dev/sda5 /media/92441EC8441EAF4B
from pylab import * # import the whole numpy-scipy-matplotlib stack
ffmpeg -f image2 -framerate 1 -i image%d.jpg video.gif # create an animated gif from a set of jpeg images
ls -v # list files numerically sorted
pinout # see a handy gpio pinout diagram
setxkbmap -types local -print
shred -vuzn 0 <file> # overwrite and remove file
getcap /usr/bin/ping # check the default capabilities of the ping executable
fc-list # list installed fonts
tune2fs -l /dev/<device>|grep "Default mount options"
type $COMMAND # display information about command type
whatis $COMMAND # display one-line manpage description
lsusb -t # list usb device hierarchy as a tree
python -m http.server # python 3.x webserver
python -m SimpleHTTPServer # python 2.x webserver
./configure -C # autoconf caching
GTK2_RC_FILES=/path/to/theme/gtkrc <command> # run an application with a different gtk theme
xrandr --output LVDS1 --mode 1024x600 --panning 1280x768 --scaling 1.28x1.28
chmod --reference=<source> <destination> # copy permissions from one file to another
chown --reference=<source> <destination> # copy ownership from one file to another
DISPLAY=":0" XAUTHORITY="$HOME/.Xauthority" vlc # start vlc from virtual console
php -S localhost:8000
mp3splt -c music.cue music.mp3
strace -p $PID -f -e trace=network -s 10000 # monitor an existing process with a known pid
gsettings set org.mate.interface gtk-enable-animations false
pip list # list installed packages
python3 -m venv # create virtual environment
upower -i /org/freedesktop/UPower/devices/battery_BAT0
aticonfig --pplib-cmd="get version"
aticonfig --pplib-cmd="notify psrc dc" # low power consumption mode
aticonfig --pplib-cmd="notify psrc ac" # high power consumption mode
usermod -l <new_username> -m -d /home/<new_username> <old_username> # rename a user
groupmod -n <old_group> <new_group>
xset dpms force off # turn off the lcd backlight
ddccontrol -p # alter settings equivalent to the hardware buttons on the monitor
xset led 3 # turn on keyboard backlight
xset led off # turn off keyboard backlight
hdparm -tT /dev/sda # measure hard disk data transfer speed
hdparm -I /dev/sda|grep -i speed # see sata link speed options
dmesg|grep -i sata|grep 'link up' # see sata link speed used
sed -i.bak 's/^M$//' file.txt # strip out "^M" characters from text file
xmllint --format ugly.xml # prettify (indent) xml files
sed 'N; /\n,/s/"\? *\n//; P; D' title_csv # regular expression over multiple lines
gcc -S file.c # convert a c language file to assembly
nbd-client -d /dev/nbd0'
modprobe <module> <parameter>=<value>
modprobe -c <module> # dump out the effective configuration
count=‘expr $count + 1‘
update-mime-database /usr/share/mime
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
modinfo -p <module> # print possible module parameters
hdparm -r0 /dev/sdb # turn off the disk devices write protect
wget -e robots=off <url> # ignore robots.txt
wkhtmltopdf http://www.cyberciti.biz/path/to/url.html output.pdf # convert a html page to a pdf
vi /etc/rc.local.shutdown
wpa_passphrase <ssid> <psk>
wpa_supplicant -h # list of valid driver values
locale charmap # query the name of the character encoding in your current locale with the command
locale -m # provide a list with the names of all installed character encodings
limit -t 600s -m 1000000k <command> <arguments> # limit time and memory consumption of a program
grep -o '[^,]*$'
ffmpeg -f concat -i inputs.txt -c copy output.mpg
ffmpeg -i input_0.mp4 -i input_1.mp4 -c copy -map 0:0 -map 1:1 -shortest out.mp4
ffmpeg -i input_0.mp4 -i input_1.mp4 -c copy -map 0:v:0 -map 1:a:0 -shortest out.mp4
dconf reset -f / # reset desktop settings to default
readelf -h /bin/uname
tar -xvfz documents.tgz -C /tmp/tgz/ # extract .tar.gz or .tgz files to a different directory
strace -e trace=open <program> # print all fopen-calls sent to the system
localedef -f ISO-8859-1 -i en_US.new en_NEW # translate en_US.new and safe the locale as en_NEW
sort -o <file> <file> # safely sort a file in place
exec python script.py # replace shell process
find . -name "*.js" -not -path "directory/*" # exclude directory from find command
genisoimage -o ../freedos_biosupdate.iso -q -l -N -boot-info-table -iso-level 4 -no-emul-boot -b isolinux/isolinux.bin .
nm <file> # list the symbols inside an object file (.o) or a (static) library (.a)
ldd <file> # list the dynamic libraries this library (.so) or executable binary depends on
ldd -Ur <file> # try to process all relocations and dynamic linking and output errors
objdump -x <file> # dump the content of the object file, library, or executable
readelf -a <file> # parse the internal structures of ELF files (.o, .so, .sl, executables) and dump them
elfdump <file>
lsof -P -T -p <pid>
fuser -v /dev/snd/*
gcore <pid> # dump the memory of the process
grep -o <pattern> # output the matching regex pattern in a line
autopep8 --in-place --aggressive --aggressive <filename> # auto format python code to conform to the pep 8 style guide
pip install pypiwin32 # install the package for the python win32api module
lame --preset standard file.wav # convert wav to mp3
backportpackage -s preci