w3resource
gallery w3resource

Rudimentary Linux Commands

 

Rudimentary Linux Commands.

Transcript

Why Learn Linux commands

1. More than 70% of total web servers run on Linux (or Unix like OS)
2. If you are not accustomed with Linux commands, you have to pay Sys Admins for even small Server administration related tasks.
3. Learning a few Linux commands may be beginning of your journey to Mastering nuances of Linux System Administration which is in high demand.

ssh - Login to your server

1. When it comes to Server, security is a key aspect. ssh offers a secure way to log in to your server.
ssh -l username servername
2. Once you issue this command, you would get ask you for password. Supply that and you will be logged in to your server’s home directory. So, if the username with which you logged in is ‘admin’, then probably you will be placed within /home/admin directory of your server.

pwd - what is your present working directory

To know what is your present working directory, issue pwd command

cd - Change your directory

To change directory, issue cd command followed by the destination directory.

ls -l - view a list of directories and files in detail

If you want to view a list of contents of a directory with a bit derail, issue ls -l command

datasoft @ datasoft-linux ~$ lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
sda1 8:1 0 73.2G 0 part
sda2 8:2 0 1K 0 part
sda5 8:5 0 97.7G 0 part
sda6 8:6 0 97.7G 0 part
sda7 8:7 0 97.7G 0 part
sda8 8:8 0 52.2G 0 part
sda9 8:9 0 45.5G 0 part /
sda10 8:10 0 1.9G 0 part [SWAP]
datasoft @ datasoft-linux ~$

Command: md5sum

The "md5sum" stands for Compute and Check MD5 Message Digest. md5sum is a computer program that calculates and verifies 128-bit MD5 hashes. It is widely used to check whether file transferring (e.g. downloading) a file has been changed or not because of faulty file transfer, a disk error or non-malicious meddling

datasoft @ datasoft-linux ~$ md5sum VNC-5.2.0-Windows.exe
0eb0d0394663bbd940a2878c3468f599 VNC-5.2.0-Windows.exe

Command: uname

The "uname" command stands for Unix Name. It prints information about
the machine name, Operating System and Kernel.

datasoft @ datasoft-linux ~$ uname
Linux

Command: history

The "history" command prints the history of long list of executed commands in terminal.

datasoft @ datasoft-linux ~$ history | more
1024 cd datasoft
1025 ls
1026 sort -k1 abc.txt
1027 sort -k2 abc.txt
1028 cat xyz.txt
1029 sort xyz.txt
1030 sort -k3 abc.txt
1031 sort -n -k3 abc.txt
1032 cat abc.txt
1033 sort abc.txt

Command: sudo

sudo refers to the file /etc/sudoers to determine who is an authorized user while executing a command which requires a little more privilege than the current user has.

datasoft @ datasoft-linux ~$ sudo
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] [VAR=value] [-i|-s] [<command>]
…………………….
……………………..

Command: mkdir

The mkdir (Make directory) command creates a new directory with name supplied after the command mkdir. It returns "cannot create folder, folder already exists" error if the the directory mentioned already exists.

datasoft @ datasoft-linux ~$ mkdir mydir.

Command: touch

The "touch" command stands for Update the access and modification times of each FILE to the current time. the command creates the file if does not exist, else it modifies the timestamp keep the contents of the file unaltered.

datasoft @ datasoft-linux ~$
touch myfile

Command: chmod

The Linux "chmod" command stands for change file mode bits. It is used to change the permission(s) of the file associated.

datasoft @ datasoft-linux
~$ chmod 755 myfile

Command: chown

The Linux "chown" command stands for change file owner and group.

datasoft @ datasoft-linux
~$ chown myfile user10
chown: invalid user: 'myfile'
datasoft @ datasoft-linux
~$ chown user10 myfile
chown: changing ownership
of 'myfile': Operation not
permitted

Command: apt

apt command stands for (Advanced Package Tool. Apt is an advanced package manager for Debian based system (Ubuntu, Kubuntu, etc.). It is used to search, install, update and resolves dependency of packages on Gnu/Linux System from command line.

datasoft @ datasoft-linux ~$ sudo apt-get update
Ign http://security.ubuntu.com trusty-security InRelease
Ign http://extras.ubuntu.com trusty InRelease
Ign http://in.archive.ubuntu.com trusty InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Hit http://extras.ubuntu.com trusty Release.gpg
Get:2 http://security.ubuntu.com trusty-security Release [59.7 kB
…………………………..
…………………………...

Command: tar

The tar program is used to create, modify, and access files archived in the tar format. "tar" stands for tape archive. It is an archiving file format.

datasoft @ datasoft-linux
~/dir2$ tar -cvf files.tar
myfile myfile2
myfile
myfile2
datasoft @ datasoft-linux
~/dir2$ ls
files.tar myfile myfile2
datasoft @ datasoft-linux
~/dir2$

Command: cal

The "cal" (Calendar), it is used to displays calendar of the present month or any other month of any year that is advancing or passed.

datasoft @ datasoft-linux
~/dir2$ cal

August 2014
Su Mo Tu We Th Fr Sa
                1  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 30
31

Command: date

The "date" (Date) command print the current date and time on the standard output, and can further be set.

datasoft @ datasoft-linux
~/dir2$ date
Wed Aug 20 12:52:54 IST
2014

Command: cat

The "cat" stands for Concatenation. Though it is generally used to display contents of files from command line, it can also be used to copy text files, combine text files and create new text files.

datasoft @ datasoft-linux
~$ cat myfile
this is file for demo

Command: cp

cp stands for Copy. It copies a file from one location to another location.

datasoft @ datasoft-linux
~$ cp myfile dir2/

Command: mv

mv command moves a file from one location to another location.

datasoft @ datasoft-linux ~$
mv myfile dir2/

Command: pwd

pwd command is used to display the name of the current / present working directory.

datasoft @ datasoft-linux ~$
pwd
/home/datasoft

Command: cd

Finally, the frequently used "cd" command stands for (change directory), it change the working directory to execute, copy, move write, read, etc. from terminal itself.

datasoft @ datasoft-linux
~$ cd dir2



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/slides/15-rudimentary-linux-commands.php