rice/dotfiles/.help.md

579 lines
14 KiB
Markdown
Raw Normal View History

2021-07-28 23:44:53 -07:00
# Help / Useful commands
## tmux
2021-10-25 18:52:55 -07:00
tmux new -s [name] # start new session named [name]
tmux a -t [name] # attatch to session named [name]
tmux ls # list tmux sessions
tmux kill-ses -t [name] # kill tmux session named [name]
2021-07-28 23:44:53 -07:00
### tmux keybindings
2021-10-25 18:52:55 -07:00
C+b $ # rename session
C+b % # vertical split
C+b " # horizontal split
C+b d # detach from session
C+b c # create new tab
C+b n # next tab
2021-07-28 23:44:53 -07:00
## sybmolic links
2021-10-25 18:52:55 -07:00
ln -s [file] [symbolic link] # creates a symbolic link for [file]
ln -sr [file] [path_to_sym_file] # creates symlink in a diff directory
2021-07-28 23:44:53 -07:00
## yarn
2021-10-25 18:52:55 -07:00
yarn global add [package] # adds a package globally
yard add [package] # add a package
yarn create react-app [name] # create-react-app with yarn
2021-07-28 23:44:53 -07:00
## firebase
2021-10-25 18:52:55 -07:00
firebase deploy # deploy code to firebase
firebase serve # run local server through firebase
firebase projects:list # list all projects
2021-07-28 23:44:53 -07:00
## curl
2021-10-25 18:52:55 -07:00
curl [web_address] # dump a webpage to the terminal
curl -L [address] # follow a link and dump the results
curl --verbose probably also -v # run with verbose
2021-07-28 23:44:53 -07:00
## nmap
2021-10-25 18:52:55 -07:00
nmap [web-address] # see what ports are open at address
sudo lsof -i -P -n | grep LISTEN # listen for stuff on ports
2021-07-28 23:44:53 -07:00
## pip
2021-10-25 18:52:55 -07:00
pip list # list pip packages installed
2021-07-28 23:44:53 -07:00
## python virtual env
2021-10-25 18:52:55 -07:00
python3 -m venv env # create the env directory
source env/bin/activate # activate the virtual environment
or . env/bin/activate
echo $VIRTUAL_ENV # prints the path to the virtual env
which -a python # lists the install locations of python
deactivate # when in a virtual session deactivates it
2021-07-28 23:44:53 -07:00
## tar
2021-10-25 18:52:55 -07:00
tar [address] # download a file from address
2021-07-28 23:44:53 -07:00
## vim
2021-10-25 18:52:55 -07:00
:sp [filename] - Opens a new file and splits your screen horizontally to show more than one buffer
:vsp [filename] - Opens a new file and splits your screen vertically to show more than one buffer
set nonumber # remove line numbers from file
Ctrl+w h # shift focus left pane
Ctrl+w l # shift fous right pane
:nohls # remove search hilighting until next search
cw # delete word and enter insert mode
^u # go up half a page
^d # go down half a page
s/<pattern>/<replace> # search and replace for pattern
V [select line] # Use visual line to select multiple lines
:g/^$/d # Remove all blank lines from a file
"xyy # Yank line to register x
"xp # Paste line from register x
"+y # yank into the system clipboard register
"+p # paste from the system clipboard register
zg # add word to local dictionary (spellcheck)
2021-07-28 23:44:53 -07:00
## markdown
2021-10-25 18:52:55 -07:00
grip <markdown file> # open a live-server for markdown file
**<>** # bold
--- # line
[...](link) # inline-style link
[desc](link "hover title") # inline-style link with hover title
2021-07-28 23:44:53 -07:00
## pacman
2021-10-25 18:52:55 -07:00
pacman -Syu --ignore=[package name] # update/upgrade all but packages in ignore
pacman -Rs package_name # remove a package and all deps not needed
pacman -Rsu package_name # if above command does not work
pacman -Qtdq # check for orphaned packages
pacman -Rns $(pacman -Qtdq) # remove orphaned packages
rm /var/lib/pacman/db.lck # remove the lock file for pacman
pacman -U /var/cache/pacman/pkg/package-old_version.pkg.tar.type # downgrade package
2021-07-28 23:44:53 -07:00
## ctags
2021-10-25 18:52:55 -07:00
ctags -R . # index the current directory with ctags
2021-07-28 23:44:53 -07:00
## ssh
2021-10-25 18:52:55 -07:00
ssh -i eecs485deploy.pem ubuntu@ec2-3-137-139-85.us-east-2.compute.amazonaws.com
ssh -p [port] user@ip
~/.ssh/config # file to change configuration for ssh
2021-07-28 23:44:53 -07:00
## insta485 server-side
2021-10-25 18:52:55 -07:00
gunicorn -b localhost:8000 -w 2 -D insta485:app # Start the server
pgrep -af gunicorn # list running guinicorn jobs
pkill -f gunicorn # stop the gunicorn server
2021-07-28 23:44:53 -07:00
## wget
2021-10-25 18:52:55 -07:00
wget [address] # download a file/files
-P # specify a directory
-c # allow to save location on INT
2021-07-28 23:44:53 -07:00
## unzip
2021-10-25 18:52:55 -07:00
unzip (file) # unzips zip file
2021-07-28 23:44:53 -07:00
## wine
2021-10-25 18:52:55 -07:00
wine (file) # install a windows file
winefile # opens the windows file system
2021-07-28 23:44:53 -07:00
## onedrive
2021-10-25 18:52:55 -07:00
onedrive --synchronize # sync the onedrive folder to the cloud
2021-07-28 23:44:53 -07:00
## text2pdf
2021-10-25 18:52:55 -07:00
text2pdf [input file] > [output] # convert input file to pdf named output
2021-07-28 23:44:53 -07:00
## netstat
2021-10-25 18:52:55 -07:00
netstat -ltnp | grep -w ':PORT' # show process running on port PORT
l - only show lisening sockets
t - display tcp connections
n - show numerical addresses
p - show PID and process name
grep -w - matching of exact string
netstat -tupan
2021-07-28 23:44:53 -07:00
## japanese keyboard
2021-10-25 18:52:55 -07:00
ibus-setup # start daemon and launch config
Ctrl+Alt+Shift # switch between languages
2021-07-28 23:44:53 -07:00
## httpie
2021-10-25 18:52:55 -07:00
http [url] # send get request with pretty printing/colors
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
## tcm - Typed CSS Modules # generate styles.css.d.ts file
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
tsm [directory or file] # generate styles.d.ts for each file or specific file
2021-07-28 23:44:53 -07:00
ranger
2021-10-25 18:52:55 -07:00
ranger # open text-based file-manage
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
## nmcli # netwrok manager command line interface
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
nmcli device # lists all device
nmcli device wifi # list wifi networks
nmcli device connct wlp1s0 -ask # connect to wifi and enter password
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
## picom # to blur stuff
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
picom & # run picom in background
2021-07-28 23:44:53 -07:00
## i3-gaps
2021-10-25 18:52:55 -07:00
Alt+Shift+G # open up the gap manager
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
## feg # set background image
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
feh --bg-scale ~/OneDrive/Pictures/what\ are\ the\ chances.jpg
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
## xprop # run xprops
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
Click on window and get information from the Window Manager about it
2021-07-28 23:44:53 -07:00
## Linux keybindings
2021-10-25 18:52:55 -07:00
Alt+Shift+g to go into gap mode and press i for inner gap and + 4 times
2021-07-28 23:44:53 -07:00
redirect stderr
2021-10-25 18:52:55 -07:00
append 2>/dev/null to redirect filehandle 2 (STDERR) to /dev/null, which is
2021-07-28 23:44:53 -07:00
## network-manager
2021-10-25 18:52:55 -07:00
nmtui # launch network manager gui
nmcli # network manager cli
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
## disown # remove a job from table of active jobs
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
disown %[jobnumber] # removes active job [jobnumber]
2021-07-28 23:44:53 -07:00
## jobs
2021-10-25 18:52:55 -07:00
jobs -l # list all active jobs
2021-07-28 23:44:53 -07:00
ps
2021-10-25 18:52:55 -07:00
ps -l # list active processes
2021-07-28 23:44:53 -07:00
## doom emacs
2021-10-25 18:52:55 -07:00
Meta=SPACE
Meta+. # open file search
Meta+b # open buffer settings
Meta+b+m # set bookmark
Meta+Return # open bookmark selector
Meta+h # help
Meta+t # toggle menu
Meta+o+p # toggle nerdtree like thing
2021-07-28 23:44:53 -07:00
## bpytop
2021-10-25 18:52:55 -07:00
New and improved bashtop written in python
2021-07-28 23:44:53 -07:00
## w3m
2021-10-25 18:52:55 -07:00
w3m www.google.com # terminal web browswer
2021-07-28 23:44:53 -07:00
## bluetoothctl
2021-10-25 18:52:55 -07:00
scan on # turn on scan
pair [device id] # connect to device
2021-07-28 23:44:53 -07:00
## locate
2021-10-25 18:52:55 -07:00
locate [filename] # return path to file
locate -b [filename] # search for file/dir in basename
suda updatedb -v # update the db with new files
2021-07-28 23:44:53 -07:00
## md2pdf
2021-10-25 18:52:55 -07:00
md2pdf <markdown file> # convert markdown file to pdf
2021-07-28 23:44:53 -07:00
## glow
2021-10-25 18:52:55 -07:00
# Read from file
glow README.md
# Read from stdin
glow -
# Fetch README from GitHub / GitLab
glow github.com/charmbracelet/glow
# Fetch markdown from HTTP
glow https://host.tld/file.md
# stash document from cli
glow stash README.md
2021-07-28 23:44:53 -07:00
## Notifications
2021-10-25 18:52:55 -07:00
/usr/share/dbus-1/services
2021-07-28 23:44:53 -07:00
## crontab
2021-10-25 18:52:55 -07:00
crontab -e # edit the cronjobs for user
crontab -l # list all cronjobs
2021-07-28 23:44:53 -07:00
## youtube-dl
2021-10-25 18:52:55 -07:00
youtube-dl [url] # download a video from youtube
2021-07-28 23:44:53 -07:00
## pgrep
2021-10-25 18:52:55 -07:00
pgrep -af [name] # searches for all process with name [name]
pgrep -x [name] # searches for name with exact matching
pgrep -l [name] # return pid and process name
2021-07-28 23:44:53 -07:00
## pidof
2021-10-25 18:52:55 -07:00
pidof [name] # gets the pid of the process with [name]
2021-07-28 23:44:53 -07:00
## gparted
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
Use application gparted to format USB drive
## getopts
2021-10-25 18:52:55 -07:00
while getopts "vk" arg; do
case $arg in
v) verbose=1;;
k) justKillIt=1;;
esac
done
2021-07-28 23:44:53 -07:00
## tor
2021-10-25 18:52:55 -07:00
ahmia.fi # dark web search engine
2021-07-28 23:44:53 -07:00
## github api
2021-10-25 18:52:55 -07:00
curl -i -u your_username:your_token https://api.github.com/user
curl -i -H "Authorization: token <access token>" \
https://api.github.com/user/repos
2021-07-28 23:44:53 -07:00
## conky
2021-10-25 18:52:55 -07:00
Ctrl+Mod(alt)+c # toggle conky
Ctrl+Mod+PgUp # next conky
Ctrl+Mod+PgDn # prev conky
# launch conky set up by Arcolinux team
conky -c /home/sudacode/.config/conky/AUR-ArcoLinux-Plasma.conkyrc
conky -c ~/.config/conky/AUR-Nemesis-Plasma.conkyrc
2021-07-28 23:44:53 -07:00
## Chiaki
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
ps4 remtote play application for linux
## Arch not booting
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
Ctrl+Alt+F5 to get to tty5
2021-10-25 18:52:55 -07:00
may need to press FN key
2021-07-28 23:44:53 -07:00
check /var/log/pacman.log
## systemctl
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
```sh
systemctl start [name] Starts service
systemctl stop [name] Stops service
systemctl enable [name] Enables service on startup
systemctl disable [name] Disables service on startup
systemctl status [name] Get status of service
```
## Fix Spotify Not Working Well
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
rm /usr/share/dbus-1/services/org.kde.plasma.Notifications.service
## heroku
2021-10-25 18:52:55 -07:00
heroku git:remote -a [project name] Connect repository to the heroku remote
2021-07-28 23:44:53 -07:00
## tokei
2021-10-25 18:52:55 -07:00
tokei show programming languages in use in current directory
2021-07-28 23:44:53 -07:00
## ncmpcpp
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
audio player
## pulsemixer
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
command line pulseaudio
## psql
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
connect to a postgresql db on another machine
psql postgresql://[username]@[addr]:[port]/[DBname]
## udisksctl
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
### mount/unmount sd card
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
udisksctl mount -b /dev/mmcblk0p1
udisksctl unmount -b /dev/mmcblk0p1
## dunst
2021-10-25 18:52:55 -07:00
dunstify "notification" display a desktop notification
2021-07-28 23:44:53 -07:00
dunstify "Progress: " -h int:value:60 display progress bar starting at 60
## Jupyter Notebook
### Add a Virtual Environment to JN
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
```bash
python -m ipykernel install --user --name=[env_name]
```
### Uninstall venv from JN
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
```bash
jupyter kernelspec uninstall [env_name]
```
### sacad: download album artwork
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
```bash
sacad [artist] [album name] [size] [output_file_name]
```
### ifuse: connect to iphone filesystem
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
```bash
$ mkdir -p /tmp/phone/
# mount the filesystem
$ fusermount -u /tmp/phone/
# unmount the filesystem
$ ifuse /tmp/phone/
```
### mdr: markdown render in the terminal
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
:MarkdownRender right
### ipython: interactive python with history, dynamic object introsepction, easier configuration, command completion, access to system shell, and integration with numerical and sientific computing tools
## nvtop
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
top for graphics card
## rofi-mpd
2021-10-25 18:52:55 -07:00
2021-07-28 23:44:53 -07:00
```bash
rofi-mpd -h
```
## UMICH Caen
2021-10-25 18:52:55 -07:00
rsync -rtv path_to_your_local_file_name your_uniqname@login.engin.umich.edu:path_to_your_remote_folder
2021-07-28 23:44:53 -07:00
## Edit files as superuser (sudo)
2021-10-25 18:52:55 -07:00
sudo -e or sudoedit
2021-07-28 23:44:53 -07:00
## nftables: firewall
2021-10-25 18:52:55 -07:00
nft -s list ruleset | tee [filename]
systemctl status nftables
2021-07-28 23:44:53 -07:00
## i3-help-log
## lscpu
2021-10-25 18:52:55 -07:00
lscpu # display info about the CPU
2021-07-28 23:44:53 -07:00
## ps
2021-10-25 18:52:55 -07:00
ps -aux # list stats about processes running including cpu and memory
ps -aux --sort=%mem/%cpu # sort by memory or cpu
ps -aux --sort=-%mem # sort by memory in ascending order
2021-07-28 23:44:53 -07:00
## kill
2021-10-25 18:52:55 -07:00
kill -l # list all kill signals
2021-07-28 23:44:53 -07:00
## ip
2021-10-25 18:52:55 -07:00
ip a # show all
ip -4 addr # show ipv4 addresses
ip -6 addr # show ipv6 addresses
2021-07-28 23:44:53 -07:00
## sqlplus
2021-10-25 18:52:55 -07:00
select * from user_sequences; # list user defined sequences
select table_name from user_tables; # list user defined tables
2021-07-28 23:44:53 -07:00
## qemu
2021-10-25 18:52:55 -07:00
# create image
qemu-img create -f qcow2 Image.img 10G
# create vm with 4G of memory with X.iso and boots directly into dvd drive
qemu-system-x86_64 -enable-kvm -cdrom manjaro-awesome-20.0-200428-linux56.iso -boot order=d -drive file=Image.img -m 4G -cpu host -smp 4 -vga virtio -display sdl,gl=on
# boots into menu
qemu-system-x86_64 -enable-kvm -cdrom manjaro-awesome-20.0-200428-linux56.iso -boot menu=on -drive file=Image.img -m 4G -cpu host -smp 4 -vga virtio -display sdl,gl=on
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
## scp: secure cp
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
# copy file to remote
scp -P 88 [file] user@host:path-to-file
# copy directory to remote
scp -rp -P 88 [directory] user@host:path-to-directory
# copy from remote to local
scp remote-user@remote-host:file path-to-file
2021-07-28 23:44:53 -07:00
## rsync
2021-10-25 18:52:55 -07:00
# copied files in archive mode (recursively run on directories)
# add --delete option to have destination delete files when deleted in src
rsync -av --delete [source] [destiation]
# exclude files with --exclude='pattern' or --exclude-from='exclude_file'
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
# rsync over the network
## wget
# add -c argument to allow to interrupt download and resume later with -c
# -P to set local download path
2021-07-28 23:44:53 -07:00
## send key to server
2021-10-25 18:52:55 -07:00
ssh-copy-id user@host
2021-07-28 23:44:53 -07:00
## CAEN VNC
2021-10-25 18:52:55 -07:00
ssh -f -L 5951:localhost:5951 uniqname@login-course.engin.umich.edu "sleep 30"
vncviewer localhost:5951
2021-07-28 23:44:53 -07:00
## Anaconda
2021-10-25 18:52:55 -07:00
source /opt/anaconda/bin/activate /home/sudacode/anaconda3
anaconda-navigator
2021-07-28 23:44:53 -07:00
PostgreSQL: postgresql://scott:tiger@localhost/mydatabase
MySQL: mysql://scott:tiger@localhost/foo
Oracle: oracle://scott:tiger@127.0.0.1:1521/sidname
SQL Server: mssql+pyodbc://scott:tiger@mydsn
SQLite: sqlite:///foo.db
## Create new Application Entry
2021-10-25 18:52:55 -07:00
/usr/share/applications/
/usr/local/share/applications/
~/.local/share/applications/
2021-07-28 23:44:53 -07:00
2021-10-25 18:52:55 -07:00
create desktop entry like others
2021-07-28 23:44:53 -07:00
## mysql
2021-10-25 18:52:55 -07:00
sudo mysql # connect to mysql as root
create database [db_name];
grant all privileges on mydb.* to user@localhost;
grant all privileges on mysql.* to user@localhost;
flush priviliges;
2021-07-28 23:44:53 -07:00
## ncdu: disk usage
## baloo
2021-10-25 18:52:55 -07:00
balooctl # control baloo
baloosewarch [search] #search for files/folders
2021-07-28 23:44:53 -07:00
## nbfc: Fan Control
## thermald: CPU Frequency Scaling
## Vim-Plug
2021-10-25 18:52:55 -07:00
:PlugInstall # install plugins
:PlugClean # clean .vim/plugged directory
2021-07-28 23:44:53 -07:00
## remoteit
# screen
2021-10-25 18:52:55 -07:00
screen -S [session_name] start named screen session
screen -S [session_name/pid] reattach
screen -S [session_name] -d -m [command] run command in detached session
screen -ls list screens
ctrl+a d detach from session
2021-07-28 23:44:53 -07:00
## mpc
2021-10-25 18:52:55 -07:00
mpc add http://host:port add stream
mpc del [num] (0 indexed) delete from queue
mpc play play (lol)
mpc toggle
2021-07-28 23:44:53 -07:00
## pdfjam
2021-10-25 18:52:55 -07:00
pdfjam [files] --outfile [file]
## nvidia-smi
nvidia-smi reads temps directly from GPU without need for X server
## mycli
mycli -h <host> -u <user> mysql command-line client with autocompletion
## Editing remote files in Vim with SSH
[github gist](https://gist.github.com/sloanlance/f481b7b8ffc0bfa3f46a1c942c7e7b78)
ssh -MNv kyasuda@dc1vsjobrunner03.westlakefinancial.com
vim scp://kyasuda@dc1vsjobrunner03.westlakefinancial.com//home/kyasuda/modules/logger.py