Simple tcp chat. Source. More info.
### Server
ncat -v -l --ssl --chat -p 8888
### Client
ncat 127.0.0.1 8888 --ssl
echo <message> > /dev/tcp/<ip_address>/<port> ## Bash only. If not using ssl.
Simple HTTP server with python
Python 2
Python 3
With other programming languages https://gist.github.com/willurd/5720255
Record screen
Get available audio devices name with aplay -l
and aplay -L
.
### Only video - 1080p - 60fps - x264
ffmpeg -f x11grab -s 1920x1080 -i :0.0 -c:v libx264 -r 60 file.mp4
### Audio and video - 1080p - 60fps - x264 - flac from pulse
ffmpeg -f x11grab -s 1920x1080 -i :0.0 -f alsa -i pulse -qp 0 -c:v libx264 -r 60 -c:a flac file.mp4
### Current resolution
xdpyinfo | grep dimensions | awk '{print $2;}'
Find funny file names
Don't know how to do[]
Share a Wifi network with a QR code
Format
Example
Pipes
Unnamed pipe
Named pipe
mkfifo pipe
ls -l > pipe ## The terminal "freezes"
grep file pipe ## Must be executed in another terminal
Control jobs
- Start a program
Ctrl + z
to stop the process.jobs
to list al the running jobs.bg
to bring the proccess to the front.fg
to keep executing the process in the background of the terminal.disown
for when you want to exit the terminal and do not want the process to finish.
Bash
# .inputrc
$if Bash
Space: magic-space
$endif
set completion-ignore-case on
"\e[A": history-search-backward
"\e[B": history-search-forward
Default apps xdg
Get the "type" of file.
Get the default app for said file type.
Set the default app for said file type.
List of all MIME types in https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.21.html, or in the code https://gitlab.freedesktop.org/xdg/shared-mime-info/-/blob/master/data/freedesktop.org.xml.in.
Short ones
dd if=/dev/zero of=/dev/null
waste cycles.