:x (Anytime you are in VIM, MAN page, LESS, etc, this is how you exit)
whereis bash (find absolute location of bash, or any file)
whatis ls (tells you about the command)
man ls (manual to give you a list of all command arguments for any command)
locate crontab (I like mlocate more)
which python (location of a program)
clear (dlears the terminal)
date (current datetime)
echo (output to terminal)
env (See environment variables)
hostname (See your hostname)
Apt (Or Aptitude) is the package manager for Ubuntu to manage packages and remove them.
Tip: You can use the
-y
flag in any apt command to skip the[Y/n]
dialog.
You need super user permissions, or sudo
before the command.
To install packages, let's use an example such as ruby which should have a list of items.
sudo apt-get install rub<TAB> ; Press the tab key to see a list, type :q to exit the list
sudo apt-get install ruby2.3
This updates the sources list located in /etc/apt/sources.list.d/
which is where the OS knows where to download files from. You will do this time to time if it's been a while.
sudo apt-get update
This will upgrade packages that have newer versions.
sudo apt-get upgrade
Removing a package is quite simple. However, this will not remove configuration files, so if you were to re-install it they would be preserved. You would use apt-get purge ruby2.3*
to purge all files.
sudo apt-get remove ruby2.3
If you get an error such as Unable to lock the administration directory (/var/lib/dpkg/) is another process
, follow these steps:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo dpkg --configure -a
; Navigating
ls (list files)
ls -la (list all files, permissions, and hidden too)
pwd (print working directory)
cd .. (go down a directory)
cd / (go to lowest level)
cd ~ (go to logged in user's home)
cd /var/www (go to absolute path)
; Manage Files and Folders
mkdir <dir> (create a directory)
rmdir <dir> (remove an empty directory)
rm -rf <dir> (remove a directory with contents)
touch <file> (create an empty file)
mv <file> <loc> (move file from location to new location)
cp <file> <loc> (copy file from location to new location)
mv <dir> <loc> (move directory from location to new location)
cp -R <dir> <loc> (copy directory from location to new location)
; Reading Files
cat <file> (read entire file)
head <file> (read top of a file)
head <file> -n 20 (read top of file 20 lines)
tail <file> (read bottom of a file)
tail <file> -n 20 (read bottom of file 20 lines)
tail <file> -f (stream file as it's updated, eg: an error log)
su - username (switch users)
sudo su (switch to root)
passwd (change logged in users password)
passwd username (change another users password)
useradd -m -s /bin/bash username
usermod -a -G existing_group existing_user
who (show all logged in users)
whoami (show which user you are)
Do not delete groups you don't know what they are used for, that's dangerous!
groups (see what groups current user belongs to)
groupadd name (create a group)
groupadd -g 900 name (create a group with custom GroupID aka gid)
groupdel name (delete a group)
useradd <group> (add current user to a group)
usermod -aG <group> <user> (append any user to an additional group)
cat /etc/group (list all groups)
cut -d: -f1 /etc/group (list all groups, cleaner)
There are two ways to manage permissions, one is by text the other is by an octal value.
; Change Mode
; Options: (O)wner (U)sers (G)roup or (A)ll
; File: Owner: rwx, Group: rwx, User: rwx
; Misc: Besides rwx there is:
; s = setuid of owner for old/new files
; Single File read/write permissions
chmod g+rw file
chmod og+rw file.txt
; Change Ownership
chown user:group files_or_folder
chgrp group files_or_folder
; Recursively:
chown -R user:group files_or_folder
chgrp -R group files_or_folder
chmod -R og+rw files_or_folder
chmod -R g+s files_or_folder
A fantastic way to structure your users is within groups. A common example would be your www-data
group.
If I have a user jesse
, I can add him with sudo usermod -aG www-data jesse
.
After adding any users I would like, I want to have a folder where all the members of the www-data
group
can read/write a folder. If they are using git, I also want the permissions to stay the same, meaning if they
pull the permissions will not change.
To accomplish this, here is an example:
sudo chown -R deploy:www-data /var/www
sudo chmod -R g+rws /var/www
The g+s
sets the file(s)/folder(s) a gid (setgid
) so that new files will inherit the original group!
You may have seen this a lot, you can use octal or decimal (begins with a 0) to do the same thing.
Permissions:
0 = None
1 = Execute (e)
2 = Write (w)
4 = Read (r)
chmod 700 file.txt
it would allow the user to Read, Write and Execute
7
is the total of 4 + 2 + 1
chmod 600 file.txt – Owner Read, Write
chmod 660 file.txt – Owner Read, Write; User Read, Write
chmod 770 file.txt – Owner Read, Write, Execute
chmod 770 file.txt – Owner Read, Write, Execute; User Read, Write, Execute
chmod 666 file.txt – All Read, Write
chmod 777 file.txt – All Read, Write, Execute
Get fundamental information about your OS with the following commands, you may have to run them as sudo
, eg: sudo lsb_release -a
.
lsb_release
lsb_release -a
lsb_release -as # Short Information
lsb_release --help
nproc # How many Processing Units
cpuid # Must install cpuid from terminal
cat /proc/cpuinfo # Lots of info
free -h # Human readable, or do --help for options
vmstat -s
cat /proc/meminfo # Lots of info
df
df -B MB (In Megabtyes, KB for Kilobytes, GB for Gigabytes)
top
htop # If you installed it
Your IP is after inet addr
. If you are connect via ethernet it's under eth0 (Ethernet)
otherwise, wirelessly it is likely under wlan0 (Wireless LAN)
.
ifconfig
ip
ip addr show
ip addr show wlan
ip addr show eth0
gnome-system-monitor
top
htop (My favorite, sudo apt-get install htop)
nmon
gsettings list-recursively org.gnome.desktop.wm.keybindings | sort | more
xev
; Or for a lot of details:
xev | grep KeyPress
The Kernal is the lowest level item that ties everything together from hardware to software. Without a kernal you cannot do anything on linux.
See What version you are currently using
sudo uname -a
See all the Kernals on the OS
sudo dpkg --get-selections | grep linux
The BYOBU is quite nice
sudo apt install byobu
sudo purge-old-kernels
shutdown
reboot
shutdown -h now
shutdown -h +10 (shutdown 10 mins)
shutdown -r now (reboot now)
crontab -e (edit crontab for current user)
crontab -l (list crontab for other user)
crontab -u jesse -l (see crontabs for specific user)
Use the service command (Requires sudo)
service ssh status (service status)
service --status-all (all services status)
Almost every service has the following commands, some may have more like apache graceful-restart
:
service servicename start
service servicename stop
service servicename restart
service servicename status
service servicename force-reload
Add Service links:
sudo update-rc.d servicename defaults
Whether you get a warning if they already exist or not, enable it now:
sudo update-rc.d servicename enable
Pass the Force flag
sudo update-rc.d -f servicename remove
There is are several startup popular daemons:
Focus on SystemD.
This would only apply to Ubuntu 14.10+, otherwise you would use Upstart.
systemctl <-- You'll use this more often
journalctl <-- You'll use this more often
update-rc.d <-- You'll use this more often
--------------------------
Installs/Removes System-V style init script links
Note: System-V Style, but it's really SystemD. (Confusing huh?)
"NNname" is the runlevel, lower means startup sooner
----------------------------------------------------
The Location is: /etc/rcrunlevel.d/NNname
The Target is: /etc/init.d/name.
notify
analyze
cgis
cgtop
loginctl
nspawn
uname -a (get linux info)
top (See running processes/system status, I suggest installing `htop`)
top -u www-data
htop -u www-data
df (display disk space in bytes, default)
df -h (display disk space human readable)
df -Th (display disk space with partitions)
free (see memory used)
free -g (in gigabytes)
ps -ef | more (current running processes)
ps -efH | more (current running processes in a tree)
ps -ef | grep vim (find vim process id)
kill -9 <id> (no brackets)
Bash is my shell of choice, which is why I have a .bashrc
file.
Executables and commands are automatically in the path, see your path with:
echo $PATH
# I suggest editing your ~/.profile
vim ~/.profile
if [ -d "/path/to/your/bin" ] ; then
PATH="$PATH:/path/to/your/bin"
fi
Note: Order of Linux Reading files: ~/.bash_profile, ~/.bash_login, and ~/.profile, so don't try to use a ~/.profile variable within ~/.bash_profile
The locations for bash completio0ns can be found at:
cd /usr/share/bash-completion/completions.d/
cd /etc/bash_completions.d/
sudo apt-get install --reinstall bash-completion
At the top of your file, find the executable you are using one of these, eg:
which bash # /usr/bin/bash
which python # /usr/bin/python
which php # /usr/bin/php
At the top of your shebang for the executable file add:
#!/bin/bash
#!/usr/bin/php
#!/usr/bin/python
make sure to +x
it:
chmod +x app.sh
chmod +x app.php
chmod +x app.py
You can then run the script via Bash:
/scripts/app.sh >> /scripts/output.log 2>&1
/scripts/app.php >> /scripts/output.log 2>&1
/scripts/app.py >> /scripts/output.log 2>&1
You could even crontab it the same way:
*/10 * * * * app.php >> /output.log 2>&1
*/10 * * * * app.py >> /output.log 2>&1
Generally the following arguments are as follows:
-type f
file-type d
directory-iname
case insensistive (book.txt would the same as BOOK.TXT)*
is a wildcard to find anything, usually you put it at the start or end of a filename.
find . -name tecmint.txt
find /home -name tecmint.txt
find /home -iname tecmint.txt (case ignore)
find / -type d -name Tecmint (directory)
find . -type f -perm 0777 -print (with perms)
find / -type f ! -perm 777 (find without)
find . -type f -name "tecmint.txt" -exec rm -f {} \; (find and remove a file)
find . -type f -name "*.txt" -exec rm -f {} \; (find and remove multiple)
find /tmp -type f -empty (Find empty files)
find /tmp -type d -empty (find empty directories)
find / -size +50M -size -100M (findby swize)
GREP means: Global Regular Expression Pattern (or Parser)
Some common GREP flags:
-r
is Recursive-n
is Line Number-w
Match the whole word-l
is lowercase only-c
supresses normal output and counts number of matching lines
grep -rn /path - "pattern_or_string"
; Output results to File
grep -rnw /path - "pattern_or_string" > output.txt
Look only in certain filetypes
; notice I used a regex ^ starts with, you can use a string or regex
grep --include=*.sh '^mysql' ./
More Examples:
grep "hello" file.txt (if in file)
grep "hello" files* (if in many files)
grep -i "hello" file.txt (case insesitive)
grep -iw "is" file.txt (get full words, case insensitive)
grep "regex" file.txt
php -i | grep ini
Without having to open a file you can simply read a part of it without nano
, pico,
vi, or
vim`:
cat file.txt (view file contents)
tail file.txt (view end of file contents)
tail -n20 file.txt (view top 20 lines)
tail -f filetxt (follow a filename keep updating)
head file.txt (view top of file contents)
head -n20 file.txt (view top 20 lines)
wget http://file.com/something.txt (Download a file locally)
wget -O newname.txt http://file.com/something.txt (Download file locally w/new name)
You can also use SCP
, yet the above are easier for non-SSH connections.
curl -O http://file.com/something.txt (Download a file locally)
curl -o newname.txt http://file.com/something.txt (Download file locally w/new name)
curl -O http://url_1 -O http://url_2 (Download multiple files)
To Compress a file you can use a variety of tools. You can type man gzip
to see the full manual and line of commands, and use esc
+ :x
and ENTER
to exit from the Manual (It usually uses the Vi editor).
Most often in the Linux word you use and create *.tar.gz
files, it has the most options. Whatever you prefer is up to you.
What the flags often stand for:
-c
is create-f
is file-k
is for Keep
gzip
& bzip2
will remove the original file once compressed.gz
when decompressing is done-r
is recursive (for gzip and zip)-v
is verbose (show details of what's happening)-z
is for tar to gzip as well--exclude='file'
is for tar (+gz if needed) to exclude certain files)Note: You can compress more than one file at a time eg: bzip2 file1.txt file2.txt file3.txt
gzip -vk file.txt (Creates file.txt.gz)
bzip2 file.txt (Creates file.txt.bz2)
tar -cvf file.tar file.txt (Creates tar)
tar -czvf file.tar.gz file.txt (Creates tar.gz)
zip filename.zip file.txt (Creates filename.zip)
zip -r folder.zip path/to/folder (Creates folder.txt.bz2)
Include/Exclude a few files:
; Exclude certain files
tar -czvf file.tar.gz <directory>/ --exclude='*.jpg' --exclude='bigfile.sql'
; Include one file type
tar -czvf file.tar.gz <directory>/*.sh
; Include multiple files types
tar -czvf file.tar.gz `find <directory> | grep '.sh\|.py'`
To Uncompress we use similar commands for most of them
gunzip -dvk file.txt.gz
gzip -dvk file.txt.gz (Same as above)
bzip2 -d file.txt.bz2
tar -xvf file.tar
tar -zxvf file.tar.gz
unzip test.zip
scp root@server.com:/path/to/file.txt file.txt
scp file.txt root@server.com:/path/to/file.txt
ssh name@server.com (default port is 22)
ssh name@server.com -p 8000 (connect to specific port)
ssh name@server.com -i ~/.ssh/rsa_key.pub (connect with ssh key)
These are safe permissions to use for SSH
chmod 700 ~/.ssh
chmod 644 ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
# Put your pubkeys (one per line) for SSH login
chmod 600 ~/.ssh/authorized_keys
You can also create a ~/.ssh/config
file and store entries such as:
Host aws
Hostname ec2-50-50-130-50.compute-1.amazonaws.com
Port 22
Identityfile ~/.ssh/id_rsa
User myusername
Host my-vps
Hostname 50.50.130.50
Port 22
User root
You can then simply type:
ssh aws
ssh my-vps
A firewall prevents unauthorized access to your machine, you should use UFW
(Uncomplicated Firewall). You must always run this with sudo
. If you don't have UFW installed, run:
sudo apt-get install ufw
To see the Firewall Status run one of these:
sudo ufw status
sudo ufw status verbose
sudo ufw enable
sudo ufw disable
Please do not do this unless you know what you are doing.
You could start out with blocking all incoming connections.
sudo ufw default deny incoming
sudo ufw default allow outgoing
Then we allow only what we want
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw allow ftp
These are the same as:
sudo ufw allow 22 # same as ssh
sudo ufw allow 80 # same as http
sudo ufw allow 443 # same as https
If SSH was on port 3333
rather than the default 22
you would do:
sudo ufw allow 3333/tcp
Some more options:
sudo ufw allow 25 # SMTP
sudo ufw allow 110 # POP3
sudo ufw allow 995 # POP3S
sudo ufw allow 143 # IMAP
sudo ufw allow 993 # IMAPS
sudo ufw allow 3306 # MySQL
sudo ufw allow 5432 # Postgres
sudo ufw allow from 192.168.255.255 # Custom IP Address
Easily delete named rules
sudo ufw delete allow ssh
Delete rules that are numbered
sudo ufw status numbered
sudo ufw delete [number]
sudo ufw reset
Regex stands for Regular Expression. It's used for locating or replacing files or strings of text. It is used all the time. These can be used in Linux itself and programming languages.
; Symbolism
; ------------------
() (captures groups)
[] (set)
{} (quantifier)
? (optional, matches 0 or 1 character)
* (matches 0 or more characters)
. (match any character)
+ (match one or more character)
\ (escape character)
! (false, is not)
^ (starts with)
$ (ends with)
| (or statement, eg: (jesse|dan|jenkins) )
; Basic Primer
; ------------------
\w (word)
\W (non-word)
\s (whitespace)
\S (non-whitespace)
\d (digit)
\D (non-digit)
[ab] (character set)
[^ab] (negated set)
[a-m] (range)
(hello) (group)
(hello)+ (group, more than once)
; Groups
; ------------------
(hi) (gets all "hi" occurances)
(^hi) (gets all text starting with "hi")
(es$) (gets all text ending with "es")
(hi)\1 (gets the first occurance of "hi")
; Flags
; ------------------
/i (case insensitive)
/g (global)
/m (multiline)
; Escaped Characters
; ------------------
; Since characters such as ".", "+", etc are actual Regex pattern makers, if you
; need to check your content for the literal item you must escape them.
\. (matches . character)
\+ (matches + character)
\? (matches ? character)
\* (matches * character)
\^ (matches ^ character)
\$ (matches $ character)
\[ (matches [ character)
\( (matches ( character)
\t (matches tab character)
\n (matches newline)
\r (matches return carriage)
\0 (matches NULL character)
\\ (matches \ character)
\/ (matches / character)
Put Examples here, like phones, names, etc..
-u
is for User (default: root)-p
is for Password-p password
is for password which skips the prompt (not recommended)-h
is for host (default: localhost)-port or -P
is for a port, default is 3306-f
will force SQL import and skips errors-v
will display verbose outputmysql>
terminal you can get clean data by doing \g
:
mysql> SELECT * FROM users LIMIT 10\g";
mysql -u root -p (username, password prompt)
mysql -u root -p -h localhost (username, password prompt, host)
mysql -u root -p password -h localhost -P 3306
; AWS Example (AWS Defaults to 3306 as most MySQL connections do)
mysql -u username -p password -h myinstance.123456789012.us-east-1.rds.amazonaws.com
You can dump a single database easily:
mysqldump -u root -p DATABASE_NAME > file.sql
Or Dump all databases on your MySQL server with the --all-databases
flag:
mysqldump -u root -p --all-databases > file.sql
You can do this through the shell only, or MySQL, first is the shell:
mysql -u root DATABASE_NAME < path/to/file.sql
To continue when there are MySQL Errors use -f or --force below:
mysql -u root DATABASE_NAME < path/to/file.sql --force
To use a password, just pass in the -p flag and type it in after running:
mysql -u root -p DATABASE_NAME < path/to/file.sql --force
Second, you can do it through MySQL once you connect:
mysql> use DATABASE_NAME;
mysql> source path/to/file.sql;
This will save a lot of space in this one liner:
mysqldump -u root -p DATABASE_NAME | tar -cvzf > output.sql.tar.gz
mysqldump -u root -p DATABASE_NAME | gzip -v > output.sql.gz
Here is how you can import with the one liner:
mysql -u root -p DATABASE_NAME | tar -xzOf output.sql.tar.gz
mysql -u root -p DATABASE_NAME | gunzip < output.sql.gz
USE DATABASE_NAME;
SELECT @@collation_database;
SELECT default_character_set_name FROM information_schema.SCHEMATA
WHERE schema_name = "TABLE_NAME";
Look at the collation table. Numeric fields won't have a collation.
SHOW FULL COLUMNS FROM TABLE_NAME
First, try this query without affecting anything to see:
SELECT CONVERT(BINARY CONVERT('We’re Here!' using latin1) using utf8);
That should fix the encoding problem.
To update a column:
UPDATE TABLE_NAME SET COLUMN_NAME = CONVERT(BINARY CONVERT(COLUMN_NAME using latin1) USING utf8);
You have to first create a repostory, through BitBucket, GitHub, GitLab, etc.
git init
touch README.md
git remote add origin git@github.com/username/yourrepo.git
git add .
git commit -m "Starting with one file"
git push origin master
git add file.txt
git rm file.txt
Create a .gitignore
file, and place something like this in it:
.tmp
.py[co]
.cache
.DS_Store
Branches are used like when you don't want to ruin a main branch with working code.
git checkout -b develop
git push origin develop
git checkout master
git checkout develop
If you were on your master
branch and only wanted to pull a single file from develop
branch, you can do this:
; Make sure you're on the branch you want to pull into
git checkout master
; Pull a single file into master from develop
git checkout develop -- relative/path.txt
; Continue by comitting and pushing to master
Tags create a snapshots of current code, you may name it as a version such as 1.0.1
and it produces a tar.gz
and zip
format for downloads.
git tag -a 1.0
git tag -a 1.0 -m "Optional Message"
git push --tags
This will remove a tag from the Git host.
git tag -d 1.0
git push origin :refs/tags/1.0
git clone git@github.com/username:your_repo.git
Clone into current directory
git clone git@github.com/username:your_repo.git .
git status
To see log data and more details use the short or long commit ID.
git log
git show eb7c86a5fbdc6c64df608f4c143c2718a100983b
This will reset your repository to the last revision and undo everything, use with caution.
git reset --hard HEAD
Removes cached items no longer read by git
git prune
To install visit https://docs.docker.com/engine/installation/linux/ubuntulinux/
This is a great utility that makes managing docker easier from a docker-compose.yml
file, you should install this after playing around with the below options. See: https://docs.docker.com/engine/installation/linux/ubuntulinux/
docker-compose up
open http://localhost:3000
This is a sample box to test once you installed docker
dock pull busybox
docker images
docker run busybox "Hi from the box"
docker ps (running containers)
docker ps -a (see all containers that ran)
This allows you to get inside the container
docker run -it busybox sh (interactive)
Removes a CONTAINER, not an IMAGE
docker ps -a
docker rm <CONTAINER ID>
You can remove containers based on their status in bulk, eg:
docker rm $(docker ps -a -q -f status=exited)
docker rm $(docker ps -a -q -f status=created)
This will download the IMAGE and run it if it doesn't exist
docker run prakhar1989/static-site
This doesn't expose ports for us to use, so we do the following:
docker run -d -P --name static-site prakhar1989/static-site
-d
detaches terminal so we can run commands in our terminal-P
publishes all exposed ports to random portsBy doing the above command we are given random ports, eg:
443/tcp -> 0.0.0.0:32768
80/tcp -> 0.0.0.0:32769
Your ports may be different, you can use specific ports with a lowercase -p
:
docker run -p 8888:80 prakhar1989/static-site
docker stop static-site
This would be a docker BASE IMAGE
docker pull ubuntu:14.04
This is a flask Example using a Python-3 Base IMAGE
requirements.txt
and just put flask
app.py
Use the following sample code in app.py
:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
Create a docker file, title it Dockerfile
Enter the following
FROM python:3-onbuild
EXPOSE 5000
CMD ["python", "./app.py"]
Now build the image
docker build -t boyus .
docker images
Get a list of images, then just delete by image id with rmi
aka remove image
:
docker images
docker rmi <IMAGE ID>
You need a repository at docker.io to push this, or probably some private hosting.
docker push boyus
Linux has a lot of GUI's and you are not limited to what you get. I'll list a few popular ones with the installation instructions in Ubuntu. You can have as many GUI options as you like, just change the default at the login screen.
Tip: After you install, logout and in the login menu or the top right you can select what GUI you want to login with. Whenever you install a new GUI you can select a Display Manager, I recommend using
lightdm
.
--
Installed in Ubuntu 12+ by Default (`ubuntu-desktop`)
; Install:
sudo apt-get install xubuntu-desktop
; Remove:
sudo apt-get remove xubuntu-desktop
; Install:
sudo add-apt-repository ppa:moorkai/cinnamon
sudo apt-get update && sudo apt-get install cinnamon
; Remove
sudo ppa-purge ppa:moorkai/cinnamon
This has been one of the all time most popular GUI's for Linux ever made, in particular the gnome-classic
.
; Install:
sudo apt-get install ubuntu-gnome-desktop (For legacy gnome use you can use gnome-shell, this install both)
; Remove:
sudo apt-get remove ubuntu-gnome-desktop (Removes gnome-shell as well)
Gnome3 has been my favorite GUI due to how I can customize it. However, for unknown reasons I have issues running only Gnome3 in VMWare Workstation 11. It works fine as a complete install.
Noteworthy: Visit Gnome Shell Extensions to customize anything you want. Make sure to use Firefox.
This is a very popular GUI for people that are used to Windows Desktops.
; Install:
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt-get update && sudo apt-get dist-upgrade
sudo apt-get install kubuntu-desktop
; Remove:
sudo apt-get remove kubuntu-desktop
; Install:
sudo apt-get install lxqt
; Remove:
sudo apt-get remove lxqt
For the best stability I use Elementary OS which is based off of Ubuntu.
; Install:
sudo add-apt-repository ppa:elementary-os/stable
sudo apt-get update
sudo apt-get install elementary-desktop
; Remove:
sudo apt-get remove elementary-desktop
; Install:
sudo apt-get install xfce4
; Remove:
sudo apt-get remove xfce4
Sometimes the system has problems, seldmoly but I'll list things that helped me fix rare occasions.
When you try to login to Ubuntu and it relogs you back into the login screen, this is an infinite loop. The only way I was able to fix it depsite all the guides was combining a few of these together for Ubuntu 16.04.
If you are using Gnome as I do, I would jump down to the Apt Auto Remove Problem in the list.
The first step is to login to a terminal.
CTRL + ALT + F1 (Or F3)
Next, Login as your user who must be able to run sudo
.
ls -ld /tmp
should have these permission exactly as: drwxrwxrwt
root:root
on /tmp
.sudo chmod a+wt /tmp
ls -lta | grep .Xa
should be owned by your user, for example jesse jesse
root root
or anything than your user/group it's wrong.sudo chown jesse:jesse .Xauthority
cat ~/.xsession-errors
sudo ~/.Xauthority ~/.Xauthority.bkup
dpkg-reconfigure lightdm
, then select lightdm in the menusudo service lightdm restart
apt-autoremove
may accidentally remove xubuntu-desktop
, ubuntu-desktop
and LightDM reports no errors.ubuntu-desktop
will load the Unity interfacexubuntu-desktop
will load a different interface I'm not familiar with.sudo apt-get install xubuntu-desktop ubuntu-desktop
sudo apt-get autoremove gnome-software && sudo apt-get install gnome-software