Check Ubuntu Version
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.6 LTS Release: 16.04 Codename: xenial
Display the current Hostname
hostnamectl //Output Static hostname: ubuntu-s-2vcpu-4gb-blr1-01 Icon name: computer-vm Chassis: vm Machine ID: 100ea3ee1d0242bab544b3cff195093b Boot ID: 36c993753f7a498bb8883b949e5e7949 Virtualization: kvm Operating System: Ubuntu 18.04.2 LTS Kernel: Linux 4.15.0-51-generic Architecture: x86-64
List the users logged in on the machine.
List all users logged in on your network. The rwho service must be enabled for this command to work.
List all Directories and files
cd cd / //To navigate into the root directory cd ~ //To navigate to your home directory cd .. //To navigate up one directory level cd - //To navigate to the previous directory
Print working directory, i.e. Display the name of your current directory on the screen.
Print the name of
the the machine on which you are working.
Print your login Name.
Copy File or Directory
The cp command will make a copy of a file for you. Example: “cp file foo” will make an exact copy of “file” and name it “foo”, but the file “file” will still be there.
If you are copying a directory, you must use “cp -r directory foo” (copy recursively).
cp -r directory DIRECTORYNAME
Move File or Directory
The mv command will move a file to a different location or will rename a file. Below Code will rename the file “foo” to “bar”
mv foo bar
Below code will move the file “foo” to your Desktop directory, but it will not rename it. You must specify a new file name to rename a file.
mv foo ~/Desktop
Create a New Directory
mkdir Command used to create a new directory.
Remove or Delete File Or Directory
rm Command to remove or delete a file in your directory.
rmdir command will delete an empty directory
To delete a directory and all of its contents recursively, use below command
rm -r DIRECTORYNAME
uname -a //Output FOR 64 Bit Ubuntu Linux YOURSYSTEMNAME 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux uname -i //Output x86_64