APT: Advanced Package Tool. Works with ‘deb‘ archive from the location specified in the “/etc/apt/sources.list” file.
- dpkg -l : List all packages
- dpkg -i <pkgname>: Install a package
- dpkg -r <pkgname>: Remove a package
- dpkg -s <pkgname>: Whether an deb package installed or not.
APT – ADVANCED PACKAGING TOOL
When you install packages from the command line with
sudo apt-get install ... (or
sudo aptitude install ...), or when you upgrade them from the command line (with
dist-upgrade instead of
install), the following information is obtained from your local system’s configuration, and not from the Internet:
- what packages are available
- what versions of them are available
- where the available packages should be retrieved from
sudo apt-get update (or
sudo aptitude update) updates this on your local system. This is the step that actually retrieves information about what packages can be installed, including what updates to currently installed packages packages are available, from Internet sources.
Because information about what updated versions of packages are available is obtained by running
sudo apt-get update (or
sudo aptitude update), it is advisable to run this before installing any package, and necessary to run it to install the latest updates, even if you have not added or removed any Software Sources (such as a PPA).
The apt-get utility is a command line program, used to work with Ubuntu’s APT (Advanced Packaging Tool) library
- installation of new software packages,
- removing existing software packages,
- upgrading of existing software packages and even used to upgrading the entire operating system.
The apt-cache command line tool is used for searching apt software package cache.
- apt-cache pkgnames : To list all the available packages
- apt-cache show scala : To check information of package
- apt-cache showpkg scala : Which packages are dependent on the package
The ‘update‘ command is used to resynchronize the package index files from the their sources specified in /etc/apt/sources.list file. The update command fetched the packages from their locations and update the packages to newer version.
- sudo apt-get update
- sudo apt-get install scala : To update specific package
- sudo apt-get install scala=2.3 : To update to a specific version of the package
- sudo apt-get remove scala: Remove a package (Configuration Files Maintained)
- sudo apt-get purge scala: Remove package with configurations
- sudo apt-get clean: Free up disk space by cleaning .deb files
Remove Java from Ubuntu
sudo update-alternatives --remove-all java
sudo update-alternatives --remove-all javac
sudo update-alternatives --remove-all javaws
sudo rm -rf /usr/lib/jvm/jdk1.8.0
mv: Short for move, this command can be used to move your files from one folder to another.
rm: Short for remove, this command is used to remove any files or folders.
cd: Short for change, you can use this command to change your current directory.
cp: Short for copy, this command can be used to copy files or folders in a directory.
chown: This command is used to change ownership of a file.
chmod: This command is used to change permissions on a file.
ls: Short for list, this command can be used to view all of the files and folders in your current working directory.
pwd: Short for print working directory, this command can be used to display the directory in which you are currently working.
sudo: Also referred to as superuser do, a sudo command allows you to run other commands with administrative privileges. This command is especially useful for modifying files in a directory that a user wouldn’t necessarily have access to.
cd: Short for change directory, this command can be used to change the directory in which you are currently working. There are a variety of cd commands that can be used to take you to specific files or folders.
cd / : An alternate to a basic cd command, the cd / command can be used to take you to the root directory.
cd .. : This command can be used to take you up one directory level.
cd – : This command can be used to navigate to a previous directory.
locate filename :
whatis ls: gives a brief description of the shell command.
type source: source is a shell bulletin
./ dot slash
A dot slash is a dot followed immediately by a forward slash ( ./ ). It is used in Linux and Unix to execute a compiled program in the current directory. For example, if you had an executable file in the current directory called “hope” and typed “hope” at the command line, you would get an error such as “-bash: hope: command not found”. This is because this command is not a built-in command, and the executable file is not found in your PATH
source is a bash shell built-in command that executes the content of the file passed as argument, in the current shell. It has a synonym in ‘.’ (period).