This post will help you to understand some Linux Basic Commands. We should be more familiar with some basic commands to access the files and Folders (Directories) in terminal mode.
If you are interested in learning, Request you to go through the below recommended tutorial.
DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
Linux Basic Commands for Beginners
Changing from one folder to different folders:
cd
"cd" command helps to go from one directory to other directory.
Example:
cd /myfolder - Go to the myfolder directory under "/" directory from current directory.
cd .. - Moves up one directory (include the two little dots)
cd - Go to the parent direcory.
cd ~ - Go to the parent direcory.
cd - - Go to the previous folder where we before.
Find the current directory where you are in:
pwd
"pwd" command Shows the current directory (folder) you are in. In Linux, by default you will get into your home directory once you logged in.
Example:
If you are in your home directory (where terminals start) and type pwd, you will see /home/user1. Now go to other directory (cd /tmp/test) and type the command "pwd" to see the current directory. You will see the output as "/tmp/test"
Making or Creating a Directory (terminal mode)
mkdir dirName - Creates a directory with name dirName.
For Example:
mkdir temp
Deleting or Removing a Directory (terminal mode)
rmdir dirName Removes a directory dirName.
For Example:
rmdir temp
Deleting or Removing a File (terminal mode)
rm fileName Removes a files.
For Example:
rm data1 Deletes the file data1 in the current directory.
rm -i data* Removes all of your files which matches the filename data as the first four letters. (careful!! rm * will remove ALL your files). The "-i" makes the computer prompt before removing each file.
Moving the files or folders
mv data1 /path/data1 - moves the file or folder data1 to the folder /path/ and deletes the old one.
Renaming the files or folders
mv data1 /path/data2 - moves the file or folder data1 to the folder /path/ as name "data2" and deletes the old one.
Copying the files or folders
cp data1 newdata/ will copy the data1 to the new directory newdata.
Listing the Files and Folders
ls - Lists files.
If you add -al options after "ls" command, it will give more details for each file. Such as, size, permissions, owners, dates etc.
ls -al - You'll see a huge list of files that you can't see with the 'ls' command alone and lots of details.
If you see such a long list of files that they scroll off the terminal screen, one way to solve the problem is to use:
ls -al |more - Shows one screen of file names at a time.
Creating or making new files
Use some below text editors to create or make a new files.
- vi
- vim
- cat
- touch
- nano
- emacs
Accessing or Mounting the CDROM or DVD media
CDROM and DVD media's wont available in linux automatically until you tell it to.
Mount the DVDROM or CDROM to some directory to access the contents of it.
mount source destination
Example : mount /dev/cdrom /media
Where "/dev/cdrom" is a source driver for both cdrom or dvdrom and /media is a destination folder where all datas of cdrom or dvdrom will be available under /media.
Ejecting or Unmounting the CDROM or DVD Media
Unmount the DVDROM or CDROM from the directory where we mounted already.
umount source
or
umount destination
Example : umount /dev/cdrom or umount /media
If you would like to see the avaiable commands in linux, please check inside the directories like /bin, /sbin, /usr/bin, /usr/sbin
Hope the post helped you to understand some linux basic commands with examples.
Related Linux contents that might be useful for you to improve your Linux Skills.
How to Configure IP Address on Ubuntu using Netplan
How to Access Linux Server from Windows Remotely
Configure SSH Passwordless Login Authentication (SSH-keygen)
How to Create LVM Partition in Linux – LVM Tutorial
Install & Configure Samba Server on Linux (RHEL7 / CentOS7)
How to Access Linux Server from Windows Remotely
Configure SSH Passwordless Login Authentication (SSH-keygen)
How to Create LVM Partition in Linux – LVM Tutorial
Install & Configure Samba Server on Linux (RHEL7 / CentOS7)
0 تعليقات