Widely used top Command's of Linux.
Widely used top Command's of Linux.
sudo (SuperUser DO) it is one of the command that we use to run programs or other commands with administrative privilages. In windows this cmd is also called "Run as administrator". We need to run cmd preceding with sudo when user try to modify the directory that user wouldn't normally have access to make changes.
These are one of the cmd that every beginner should know this cmd is used to update, upgrade and remove any pakages.
sudo apt-get update
apt-get update with super user privileges is the first command you need to run in any pnux/ubuntu system after a fresh install. It updates the package database and let your system know if there are newer packages available for update or not.
After updating the database package,now we will upgrade the install pakages. For upgrading all the packages with available updates you need to run the below command.
sudo apt-get upgrade
For updating a particular package we need to run the below cmd with pakage name. If you don't remember the pakage exact name then just type few words and press Tab it will suggest you package names.
sudo apt-get install "package name"
If you want to remove the package then you just need to type remove in place of install command.
sudo apt-get remove "package name"
ls command will pst you all the current working directory you can also specify the path to other directory to view file and folders.
[email protected]:~$ cd Pictures/
[email protected]:~/Pictures$ ls
cd is also known as chdir used to change the current working directory. For open or change to dir having space in it's name use "/ " backslash+ space. For example cd dir/ name to change "dir name" directory.
cd / -move you to root dir.
cd .. -move you back to one dir.
cd - -move you back to next dir.
cd home -open a home dir in current working dir.
pwd (print working directory) it will show full path of current working directory.
cp/mv command is used to copy/move file from one directory to another directory.
cp file/location /destination/directorymv file/location /destination/directory
rm command remove directory or specific files.
rmdir test_dir/ (it will remove empty directory)
rm -r test_dir/ (-r (recursively) it will remove directory with content)
mkdir (make directory) it will create a new directory.
This command will print all the command you used, It will show approx 500-600 previously used command's.
[email protected]:/$ history
1 sudo apt update
2 sudo apt install openssh-server
3 sudo ufw allow ssh
4 sudo ufw allow 8000
5 mkdir test_dir...
df (display filesystem) will show you all the information about disk space usage of all the mounted space.
du (display usage) it show you directory and subdirectory sizes and usages.
It will show you free and used memory and swap space. It will also show you buffer and cache space.
[email protected]:/$ free
total used free shared buff/cache available
Mem: 3800628 1779164 1003576 303156 1017888 1439220
Swap: 2097148 399260 1697888
13. uname -a
uname -a It will show you wide range of basic information about your system.
top will show you current running processes with process id's, size usage, running time etc. "q" will used to quit
man is an interface to the system reference manuals or manual page. We can use man cmd with other cmd for example
man ls (Display the manual page for the item (program) ls)
info is similar to man but it provides more details about the command usages.
It is used to get help about the particular command. How to use it or different arguments we can use with this particular command.
You can change your system password using command prompt.
[email protected]:/$ passwd
Changing password for neptune.
Retype new password:
Change the owner and/or group of each FILE to OWNER and/or GROUP. With --reference, change the owner and group of each FILE to those of RFILE. for example
chown root /u Change the owner of /u to "root".
chown root:staff /u pkewise, but also change its group to "staff".
chown -hR root /u Change the owner of /u and subfiles to "root".
It will show you the purpose of the command in a very short form or in single pne.
chown (1) - change file owner and group
chown (2) - change ownership of a file
cal will show you the calender of current month.
[email protected]:~$ cal
Su Mo Tu We Th Fr Sa
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
date will show you the today date and time.
Saturday 15 August 2020 12:58:08 PM IST
22. ls -al
It will print total no of file
[email protected]:~$ la -al
drwxr-xr-x 33 neptune neptune 4096 Aug 2 17:48 .
drwxr-xr-x 4 root root 4096 Jun 20 10:42 ..
top cmd will show you all the running processes.It will also show each and every detail of CPU usage, memory used, etc.
top - 13:16:33 up 1 day, 3:50, 1 user, load average: 0.42, 0.50, 0.66
Tasks: 228 total, 2 running, 225 sleeping, 0 stopped, 1 zombie
%Cpu(s): 4.2 us, 1.9 sy, 0.0 ni, 93.6 id, 0.0 wa, 0.0 hi, 0.3 si, 0.0 st
MiB Mem : 3711.5 total, 963.1 free, 1823.3 used, 925.2 buff/cache
MiB Swap: 2048.0 total, 1989.4 free, 58.6 used. 1450.1 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15043 neptune 20 0 2793768 402844 148940 R 8.0 10.6 1:51.03 Web Content
7443 neptune 20 0 3950832 431168 159444 S 7.3 11.3 43:49.35 firefox
1601 neptune 20 0 1753192 100968 82908 S 4.0 2.7 17:50.01 Xorg