A cheat sheet for Linux commands, and how to install some packages and drivers.
Stop containers:
docker stop $(docker ps -a -q); docker rm $(docker ps -a -q)
docker stop $(docker ps -a -q)
Remove containers:
docker rm $(docker ps -a -q)
Remove images:
docker rmi $(docker images -a -q)
Prune stuff:
docker volume prune
docker image prune
docker network prune
docker system prune -a
Remove networks:
docker network rm $(docker network ls)
Stop, build, and restart production containers:
docker-compose -f docker-compose-production.yml down
docker-compose -f docker-compose-production.yml up --build
docker-compose -f docker-compose-production.yml start
Use the docker logs CONT_ID
command to get logs for a container.
Pipe grep
to docker logs
to search the logs for a string match:
docker logs CONT_ID 2>&1 | grep "SEARCH FOR THIS"
Find out your user name:
whoami
Get full path to current directory
pwd
ls
ls -l@
Hidden files start with a period ("."). List all files and hidden files
ls -a
clear
cd ..
sudo rm /path/to/file/some-file.txt
Be careful with this command:
sudo rm -rf /path/to/directory
rmdir /path/to/some/dir
touch /path/to/some/directory/new-file.py
# OR this for new file in 'pwd':
touch new-file.txt
locate some-file-name
sudo mv /path/to/file/some-file.txt /new/path/location
sudo mv old-file-name.txt new-file-name.txt
man {SOME_COMMAND}
# for example: man history
# Press CTRL+Z to exit
python3
# ..or for Python v2.x
python
# Press CTRL+Z to exit
Pipe the grep
command to history
to find a string match of a previously executed command:
history | grep {SOME_KEYWORD}
ps aux | grep -i apt
sudo kill -9 <process id>
tar xzf file.tar.gz
tar xjf file.tar.bz2
tar xzvf file.tar.gz
stat -f '%A %N' path/to/dir
sudo apt install aptitude
sudo aptitude install cpufrequtils
sudo cpufreq-set -f 2000
indicator-cpufreq
for x in /sys/devices/system/cpu/*/cpufreq/; do echo 800000 | sudo tee $x/scaling_min_freq; done
cpufreq-info
sudo cpufreq-set -f `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
sudo apt update
sudo apt upgrade -y
sudo apt install snapd
sudo apt purge snapd
sudo apt install snapd
snap find "program name"
sudo snap install {PROGRAM}
https://thishosting.rocks/install-php-on-ubuntu/
mkdir lua_build
cd lua_build
wget http://www.lua.org/ftp/lua-5.3.4.tar.gz
sudo tar -zxf lua-5.3.4.tar.gz
cd lua-5.3.4
sudo make linux test
sudo make install
sudo add-apt-repository ppa:bartbes/love-stable
sudo apt-get update
or
sudo apt install love
- https://eev.ee/blog/2016/04/30/embedding-lua-vs-python/
- https://stackoverflow.com/questions/4527261/how-could-i-embed-lua-into-python-3-x
- http://labix.org/lunatic-python
- https://pypi.org/project/lupa/0.9/
sudo wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz
sudo tar -xvf go1.12.1.linux-amd64.tar.gz
sudo mv go /usr/local
export GOROOT=/usr/local/go
export GOPATH=/path/to/project
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
Ask Ubuntu - Create a live USB
sudo apt-get install usb-creator-gtk
sudo add-apt-repository ppa:gezakovacs/ppa
sudo apt-get update
sudo apt-get install unetbootin
/etc/init.d/apache2 restart
# or
sudo /etc/init.d/apache2 restart
xinput set-prop <id> "Device Enabled" 0
sudo apt install aptitude
sudo aptitude install cpufrequtils
sudo apt-get install firefox
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
gsettings set org.pantheon.files.preferences single-click false
gsettings set org.gnome.desktop.interface text-scaling-factor 1.2
gsettings set org.pantheon.terminal.settings unsafe-paste-alert false
gsettings set org.gnome.desktop.notifications show-banners false
Uninstall Skype:
sudo service bluetooth restartSKYPE
sudo apt remove skype
sudo apt remove skypeforlinux.
sudo apt install apt-transport-https curl
curl https://repo.skype.com/data/SKYPE-GPG-KEY | sudo apt-key add -
echo "deb [arch=amd64] https://repo.skype.com/deb stable main" | sudo tee /etc/apt/sources.list.d/skype-stable.list.
sudo apt update
sudo apt install skypeforlinux
Ask Ubuntu - Fix Bluetooth Issues
sudo service bluetooth restart
<cite>"I've edited the `/etc/bluetooth/audio.conf` file: `sudo -H gedit /etc/bluetooth/audio.conf` and add this line in the end of it: Disable=Headset. Users on Ubuntu 17.04 and above may not have `audio.conf`, but can instead use `main.conf`."</cite>
__PEEK:__
```bash
sudo add-apt-repository ppa:alexlarsson/flatpak
sudo apt update
sudo apt install flatpak
flatpak install --user https://flathub.org/repo/appstream/com.uploadedlobster.peek.flatpakref
flatpak run com.uploadedlobster.peek
flatpak update --user com.uploadedlobster.peek
https://github.com/phw/peek
sudo hdparm -r0 /dev/
Use fdisk
to find all drives:
sudo fdisk -l
Or use df
to show volumes:
df
The drive will be: /dev/sdb{X}
sudo umount /dev/sdb{X}
Un-mount the drive:
sudo mkfs.vfat -n 'LINUX_BOOT' -I /dev/sdb{X}
# ..or
sudo mkfs.vfat -I /dev/sdb{X}
Format the drive as FAT32:
ls -1 /dev > ~/before.txt
ls -1 /dev > ~/after.txt
diff ~/before.txt ~/after.txt
sudo apt install exfat-fuse exfat-utils
for x in /sys/devices/system/cpu/*/cpufreq/; do echo 1200000 | sudo tee $x/scaling_max_freq; done
sudo apt install aptitude
sudo aptitude install cpufrequtils
Atom IDE Menu Font Not-Visible
wget -O atom-amd64.deb https://atom.io/download/deb
sudo add-apt-repository ppa:webupd8team/atom
sudo apt update
sudo apt install atom
wget -c https://zoom.us/client/latest/zoom_amd64.deb
sudo apt-get install libxcb-xtest0
sudo dpkg -i zoom_amd64.deb
sudo apt install chromium-browser
"BROADCOM 4360 comes with two different chips: 14E4:4360 NOT SUPPORTED and 14E4:43A0 SUPPORTED"
Check for hardware support:
lspci -vnn | grep -i net
sudo apt-get update
sudo apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms
OR:
sudo apt-get install --print-uris linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms
sudo modprobe -r b44 b43 b43legacy ssb brcmsmac
modprobe wl
sed -i '/PasswordAuthentication yes/s/^#//g' /etc/ssh/sshd_config
sed -i '/PermitRootLogin prohibit-password/s/^#//g' /etc/ssh/sshd_config
sed -i '/PermitRootLogin prohibit-password/s/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sudo nano /etc/mbpfan.conf
sudo fsck /dev/sdc1