Check where and who you are and what time it is
$ pwd && who
Go to main directory
$ cd /
List all files and directories
$ ls -lAh
$ df -aHT
All processes information can be found using one of the commands:
$ top
$ htop
$ ps -ely
Processes information containing as in the name
$ ps -ely | grep 'as'
Processes information seen from root perspective containing desired names of service
$ sudo ps -ely | grep '(name_of_desired_service>)'
Check if the filesystem is ok (better without gui)
$ fsck /dev/sda2
Simple update and upgrade of all the packages present in the system can be completed using following set of commands
$ sudo apt-fast update
$ sudo apt-fast upgrade -f -y
Repair ubuntu after interrupted dist-upgrade (or other disaster) without losing any custom settings.
This is to be done without GUI. Go to recovery mode command line as root and start typing:
$ mount -o remount, rw /
$ mount --all
$ dpkg --configure -a
$ apt-get update
$ apt-get -f install
$ apt-get -m install
$ apt-get -y install
$ apt-get dist-upgrade
$ apt-get install --reinstall ubuntu-desktop
$ apt-get autoremove
$ apt-get clean
$ shutdown -r now
Fast and reliable update of Android software
$ apt-get update
$ apt-get install -f
$ apt-get install -m
$ apt-get upgrade
$ apt-get dist-upgrade
$ apt-get autoremove
$ apt-get autoclean
Procedure of installation of the software
Add the PPA [ppa_name] repository to system
$ sudo add-apt-repository ppa:[ppa_name]/[package_to_install]
$ sudo apt-fast update
Install [package_to_install] forcing installation of the newest version
$ sudo apt-fast install [package_to_install] -f -y
Check whether log for newly installed [package_to_install] has been created:
$ sudo cat /var/log/[package_to_install]/[package_to_install].log
Check whether data needed to have application working correctly has been created in one of the following paths:
$ ls -lAh /usr/bin/
$ ls -lAh /var/lib/
Procedure of uninstallation of the software
In this example we will uninstall mongodb
$ sudo systemctl stop mongod
$ sudo systemctl status mongod
$ sudo apt-fast purge mongod
$ sudo apt-fast autoremove
All the application data, user data, configuration files and logs should be removed as well after software uninstallation.
Removing log:
$ sudo rm -rf /var/log/mongodb/mongod.log
Removing application data:
$ sudo rm -rf /var/lib/mongodb
Removing configuration file:
$ sudo rm -rf /etc/mongod.conf
List all the repositories available on your Ubuntu system
$ apt policy
While installing new software (here we use mongodb as an example) with default settings there should be done changes and creations of new data in the following paths:
Binary data in /usr/bin/mongod
Data of application in /var/lib/mongodb/
Logs in /var/log/mongodb/mongod.log
Configuration file in /etc/mongod.conf
Log can be viewed by using command cat with sudo privileges
$ sudo cat /var/log/mongodb/mongod.log
Content of the directory can be checked by using command ls like below:
$ ls -lAh /var/lib/mongodb
To check the status, stop, start or restart of the service(s) like in this example mongod you should use following commands:
$ sudo systemctl status mongod
$ sudo systemctl stop mongod
$ sudo systemctl start mongod
$ sudo systemctl restart mongod
Alternatively you can use following commands to get the same result as mentioned above:
$ sudo service mongod status
$ sudo service mongod stop
$ sudo service mongod start
$ sudo service mongod restart
To disable or enable service mongod at system startup you should use following commands:
$ sudo systemctl disable mongod
$ sudo systemctl enable mongod