Linux commands
Jump to navigation
Jump to search
Contents
Directory
Create directory with perms and cd to it
mkdir -m 777 <dirname> && cd "$_"
df -h du -h --max-depth=1 /var/lib/docker/vfs/dir
realpath
Sed
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
SSH
SSH tunneling
- 1.1.1.1 host
- 22 SSH port
- 3333 VNC port
ssh -p 22 -L 3333:localhost:3333 1.1.1.1 -i .ssh/id_ecdsa
SSH config
Edit file in .ssh/config
Host * AddKeysToAgent yes ServerAliveInterval 120 ServerAliveCountMax 2 Host jump-server User root Hostname 8.8.8.8 IdentityFile /home/juraj/.ssh/juraj_openssh Host server2 User root Hostname 1.1.1.1 Port 22 ProxyCommand ssh -q -W %h:%p jump-server
Docker
docker stat watch docker ps -a docker ps -a docker images docker logs -f <container> docker build --network host -t tunnel . docker-compose up -d docker run -d --name <container_name> --network host --cap-add=NET_ADMIN,NET_RAW <image_name> docker exec -it <container_name> /bin/bash docker rm <container> docker kill <container> docker stop <container> docker image rm <image> docker image rm --force <image> docker rmi $(docker images -q) docker inspect <container> --format='{{.State.Running}}' docker inspect <container> --format='{{.State.StartedAt}}' docker events --filter event=restart docker events --filter event=restart --since=60m
Curl/Wget
curl --upload-file /tmp/output.pcap https://test.com
Date
date +%s --date '2021-10-26T09:06:37.492700403Z'
Encoding
echo "base64code" | base64 -d
Package Manipulation
Update python packages https://www.activestate.com/resources/quick-reads/how-to-update-all-python-packages/