tl;dr : If you are an angry Windows alien using Linux, you will need these commands.
I assume it is just as frustrating for a Linux user to use Windows and vice versa. I am a Windows user who has to use Linux occasionally. I am no stranger to the command line. But there is so much stuff I just can’t remember, because I only need to use it once in a blue moon.
So, here is a list of command line tasks I wish I could remember.
Sudo Without Typing Password
Add the following line at the end of the file:
billgates ALL=(ALL) NOPASSWD: ALL
Or edit /etc/sudoers
Mounting Windows Shares
sudo apt-get install cifs-utils sudo mount -t cifs //server.local/myshare /mnt/myshare -o user=billgates,pass=password,rw,uid=$(id -u),gid=$(id -g),noserverino
Running a Live Ubuntu Distro
Installing packages can fail with an error “E: Unable to locate package”. Seems that the “universe” repository needs to be added:
sudo add-apt-repository universe
Install a .deb-File
sudo apt install ./name.deb
Create an Empty File, Make it Executable and Give it Root Access
touch file.sh chmod u+x file.sh chmod 777 file.sh
Don’t forget to start the file with “#!/bin/bash”.
Lists all block devices.
Run a Script on Login
Edit the file .profile in your home directory. Add this line:
Install a Driver
sudo insmod driver.ko dmesg
Install a driver permanently:
Copy driver.ko to /lib/modules/$(uname -r) sudo depmod -a modprobe driver Create /etc/modules-load.d/driver.conf containing one line with the driver name (here: "driver")
Find out Kernel Version
Find out Linux Version
Save Passwords in Git
git config credential.helper store
Commit (and add) in Git
git commit -a -m "message"
Pull and overwrite local changes in Git
git fetch --all git reset--hard origin/master
Debian: Fix that apt requests CDROM media
Comment out the line which refers to the CDROM in /etc/apt/sources.list
sudo nano /etc/apt/sources.list
Debian: Install sudo
su apt install sudo usermod -aG sudo billgates
Note that you need to reboot the system.
Fedora: Installing Software
sudo dnf install nano
Quickly Start a Web Server
sudo python -m SimpleHTTPServer 80
fsarchiver: Partition imaging