Skip to content

Latest commit

 

History

History
78 lines (62 loc) · 2.54 KB

File metadata and controls

78 lines (62 loc) · 2.54 KB

Terminal commands

Delete/find files/folders:

find /srv/shiny-server/replenishment/releases -name "201711*"
find /srv/shiny-server/replenishment/releases -name "201711*" -print0 | xargs -0 rm -rf
find /srv/shiny-server/replenishment/releases -name "201711*" -delete

Find text in files

grep -R --include="*.py" "text-pattern-to-search" /path/to/dir/where/to/search

List files with their sizes:

du -sh /srv/shiny-server/*

or as a tree

tree [-L #] /srv/shiny-server/* (-L defines the # of levels of depth to list)

cat the most recent file (e.g. in shiny logs)

cat "$(ls -rt | tail -1)"

Convert ; delimited CSV to , delimiter

cat semicolon_delimited.csv | tr ";" "," > comma_delimited.csv

Print the number of rows in a CSV

wc -l my_commaseparated_file.csv
cat commaseparated_file.csv | wc -l (faster version in case needed to use multiple times)

Search as you type and cycle through results:

Ctrl + R

EMS query

Query hds from terminal (etl01)

ssh etl01
psql -U bigdata_ro -p 5432 -h 10.22.0.201 hds
(provide password from db_config.yml)

Query suite from terminal (devmgmt1)

ssh devmgmt1
database.sh suite0

ZSH aliases

resolve alias by typing (e.g.) `type command-hints`
zshconfig
ems
dbconfig
hotkeys
copyconfig
rstudio
crp
dip, dil (docker)

GIT

Remove local commits and changes on disk too: `git reset --hard <last good SHA>`
Do the above w/o `--hard` to remove commits but keep the changes on disk
Undo public change: `git revert <SHA>` creates a new commit that removes the previous changes
Undo uncommited local changes: git checkout <bad filename>
Show log of changes to HEAD: `git reflog`
Show diff from remote (two way diff): `git fetch && get diff master origin/master`
    One way diff: `git fetch && get diff master...origin/master`
Merge conflict: Accept theirs/ours: `git checkout --ours/--theirs <path>`
Merge a single file from an other branch: `git checkout <source-branch-name> <path-to-file>`
Merge master to your branch. On your branch: `git merge master`
Delete, squash, reorder commits interactively: git rebase -i HEAD~12
Set upstream automatically to 'origin': git config --global push.autoSetupRemote true

Docker

docker ps (alias ~ dp)
docker image ls (alias ~ dil)
docker run -it [docker-image-name:tag] sh
docker ps [-a]
docker image prune -f (alias ~ dip)

YADM

yadm list -a
yadm add -u (add all changed files)

OS information

cat /etc/os-release