Skip to content

Instantly share code, notes, and snippets.

@glw
Last active July 18, 2017 20:11
Show Gist options
  • Save glw/7782783 to your computer and use it in GitHub Desktop.
Save glw/7782783 to your computer and use it in GitHub Desktop.
Useful Bash commands
# recusively copy files from sub-directories into the parent
$ find ./recursive_search/ -name '*.txt' -exec cp --backup=numbered -t ./ {} +
==========================================================================================================
#how to create a install script http://askubuntu.com/questions/47404/how-do-i-make-post-install-scripts
===========================================================================================================
#how to find install name
$ lsb-release -a
===========================================================================================================
#update and upgrade currently installed packages
$ sudo apt-get update && sudo apt-get upgrade
===========================================================================================================
#install a specific package
$ sudo apt-get install <package name>
===========================================================================================================
# A better way to get information on packages then using dpkg would be to use aptitude
# lists all installed packages
$ dpkg --get-selections
# finds an installed package begining with the characters specified also check out https://help.ubuntu.com/community/FindingFiles
$ dpkg --get-selections | grep <package name>
$ aptitude show <package name>
# add a '?' to use as a search
$ aptitude show <package name>?
===========================================================================================================
# List installed packages
$ zcat -f /var/log/dpkg.log* | grep "\ install\ " | sort
# or
$ dpkg -l | grep <package name>
$ aptitude versions ~i
===========================================================================================================
# To find the locations of a package use -L
$ dpkg -L <package name>
===========================================================================================================
# Add respository
$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
===========================================================================================================
# Install an application
$ sudo apt-get update
$ sudo apt-get install <package name>
===========================================================================================================
# correct any broken dependencies
$ sudo apt-get -f install
===========================================================================================================
# install/update broken dependencies *Use with caution
$ sudo apt-get dist-upgrade
===========================================================================================================
# uninstll packages
$ sudo apt-get remove [package name]
===========================================================================================================
# uninstall old dependencies
$ sudo apt-get autoremove
===========================================================================================================
# Extract and install tarball
tar xzf filename.tar.gz
or
tar xzf filename.tar.gz.bz2
===========================================================================================================
# When windows manager crashes
xfwm4 --replace # >>> further you may have to add an autoatart enrty. to do so, To create an autostart entry, From the Main Menu choose Settings, then Settings Manager, then Session and Startup, then click on the Application Autostart tab. Once there, click the "Add" button, then set the following:
#- Name = xfwm4
#- Description = xfwm4
#- Command = xfwm4 --replace (or xfwm4 --display=:0.0 --replace)
===========================================================================================================
# Start UbuntuOne Control Panel
ubuntuone-control-panel-qt --with-icon
===========================================================================================================
# Can not upgrade because /boot is full
http://askubuntu.com/questions/142926/cant-upgrade-due-to-low-disk-space-on-boot
===========================================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment