Being as a sever administrator or DevOps engineer or DBA, you must learn all basic Linux commands. Here I am going to tell you all basic Linux commands which you must know if you are thinking to work on Linux as your primary operating system.
ls
ls command will list all files and folders in current directory.
ll
ll command will also show all the files and folders in current directory but it also tells some extra information(permissions, creation date and time, size, owner etc.) about files/folders.
pwd
pwd command will tell the path of current directory.
mkdir
mkdir will create a new folder in current directory.
cp
cp command will copy and paste your file/folder to destination directory.
cp targetFile/ PathToDestinationFolder/
If you have to copy a directory(folder) then you also need to type ‘-r’ for recursion, it will tell that the directory and all files and folder in that directory will be copied.
cp -r targetFolder/ PathToDestinationFolder/
mv
mv command will move file/folder from current directory to destination directory.
cp targetFile/ PathToDestinationFolder/
rm
rm command will remove files/folders.
rm fileName
If you have to remove a directory(folder) then you also need to type ‘-r’ for recursion, it will tell that the directory and all files and folder in that directory will be deleted.
rm -r targetFolder/
chmod
Sometimes you have to deal with permission of files and folders so that operations(read, write, execute) could be performed with appropriate permissions.
chmod permissionCode Folder/File
touch
touch command is used to create a new file.
vi
On linux, you can use vi editor to create and edit files.
There are some other commands(Example: wq! | dd | sift+g) you need to learn in order to work with vi editor.
ssh
This command is frequently used when you work with server. ssh makes connection of your remote device to with servers.
ssh -i privateKey.pem username@ipAddress
scp
scp command is used when you have to copy something from remote device to server or server to remote device.
scp -i privateKey.pem fileName.txt username@public_DNS:~/. ;
history
This command will print all commands typed in past.
history
To clear all history type –
history -c
grep
This command will help you in finding a particular data in a group of data. This is really useful command for devops.
Example: I typed ll to list all files and folders in a directory. Now I want to find a particular file.
I typed “ll | grep aws”
It will list only those files which contains word “aws”.
magnificent submit, very informative. I ponder why the other specialists of this
sector don’t notice this. You should continue your writing.
I am confident, you have a huge readers’ base already!
I’m typically to blogging and i actually respect your content. The article has really peaks my interest. I’m going to bookmark your site and preserve checking for brand spanking new information.