Skip to content

Instantly share code, notes, and snippets.

@miketery
Last active June 18, 2021 18:48
Show Gist options
  • Save miketery/87119ab22d4d7a356414515941e429ce to your computer and use it in GitHub Desktop.
Save miketery/87119ab22d4d7a356414515941e429ce to your computer and use it in GitHub Desktop.
Commands that are forgettable for me
# collapse multi line file
# e.g.
# col 1
# col 2
# col 3
# col 1...
# OUTPUT: col1, col2, col3
sed 'N;N;s/\n/ /g' file
# show pots used by sys (source: https://unix.stackexchange.com/questions/62247/how-do-i-know-what-service-is-running-on-a-particular-port-in-linux)
lsof -i :port -S
netstat -a | grep port
ls -tp | grep -v '/$' | tail -n +6 | xargs -I {} rm -- {}
# Linux Create User
useradd username
# add keys
mkdir .ssh && chmod 700 .ssh
echo $KEY >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
# generate ed25519 key pair
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519
# distro
cat /etc/*-release
# run private chrome
#!/bin/sh
test -e "$(which chromium)" && CHROME="chromium"
test -e "$(which google-chrome)" && CHROME="google-chrome"
test -e "$(which google-chrome-dev)" && CHROME="google-chrome-dev"
TMPDIR=`mktemp -d /dev/shm/chrome-XXXXX`
$CHROME --user-data-dir=$TMPDIR --no-first-run --no-make-default-browser "$@"
rm -rf $TMPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment