Updating and Upgrading software
This is a very common apt command that is used to update your software sources. It is the first command that you enter when you have installed a fresh ubuntu.
sudo apt-get update
upgrade command downloads and installs any newer versions of your installed software. make sure you run the above update command first so that the software sources are first updated and you get latest software.
sudo apt-get upgrade
This command first downloads and then installs a new software. here we are installing a software called virtualbox. replace virtualbox with any other software you want to install.
sudo apt-get install virtualbox
Now, to remove an existing software
sudo apt-get remove virtualbox
List all files/dirctories
The ls command lists all files and directories
If you want to see a long listing (detailed) use -l option
The -a option will list all files including hidden files
Creating a new file and folder
The touch command creates a empty new file
The mkdir command creates a new empty directory
Add contents to a file
use the cat command with redirection ‘>’ to add text to a file. Press Ctrl+D when you have finished adding text.
cat > myfile
View Contents of a file
use the cat command to view contents of an existing file. let’s view myfile , that we created in the previous command
with cd command you change your directory. by default you are in home directory. Let’s change our directory to Desktop
Note: linux is case sensitive so don’t type ‘deskop’ but ‘Desktop’.
To come back to your previous directory(home directory)
the double dot means the parent directory
just the cd command will take you to your home directory from wherever you are.
Present working Directory
the pwd command shows your current directory with full path name
Delete a file
‘rm’ stands for Remove and this will Delete the file myfile Permanently so you won’t be able to Restore it from Trash.
Copy a file
To copy files, you use the cp command. The following will copy file from home folder and paste it to Desktop.
By default you will be at your Home folder so you don’t need to change the directory.
sudo cp abc Desktop
Move a file
to move a file to different location, you use the mv command.The following command will cut file from Home folder and paste it to Desktop
sudo mv abc Desktop
lsb_release -a – Distribution info
cat /etc/issue – current distribution and version
apt-cache showpkg packagename – packagename’s version and dependencies
uname -r – Linux kernel version
uname -a – all kernel details
glxinfo – details about OpenGL, the Xserver, and your graphics card
glxinfo | grep vendor – graphics card vendor
lspci | grep VGA – specific graphics card model
glxgears – a simple 3d benchmark, prints frame rate to the terminal
xrandr – supported display resolutions
lspci | grep Audio – audio controller
aplay –list-devices – more audio device information
ifconfig – networking interfaces, IP addresses, and more
cat /proc/cpuinfo – all processors, clock speeds, flags, and more
cat /proc/loadavg – processor load average for the last 1, 5, and 15 minutes
top – press C key to sort processes by CPU usage
cat /proc/meminfo – amount of RAM and swap, and how much is being used for what
free -m – total, used, and free memory shown in MB
top – press M key to sort processes by memory usage
df -H – partitions, as well as their mount-points and usage in GB
sudo fdisk -l – all partitions, their device names, and positions on disk
lsusb – USB buses and attached devices
lshal -m – monitor for hardware changes
lspci – all PCI devices
hwinfo –short – overview of all hardware, as well as more detailed info
lshw – another program for listing hardware
lshw -html | w3m -T text/html – lists hardware with HTML output in the w3m web browser
uptime – current time elapsed since last reboot, users, and load average