Assignment ON Networking

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

ASSIGNMENT

ON
NETWORKING

TOPIC:LINEX COMMANDS

SUBMITED TO : SUBMITED BY :
SHIRON KURIAN ANANTHU A NAIR
18PMC212
INTRODUCTION
Linux is a UNIX-base operating system. Its original creator was a Finnish student named Linus
Torvalds, although being ‘open source’ it has changed a great deal since its original conception.
It belongs to nobody and is free to download and use. Any changes to it are open for all to
adopt, and as a result, it has developed into a very powerful OS that is rapidly gaining in
popularity worldwide, particularly among those seeking an alternative to Windows.

In 1991, hardware was expanding rapidly, and DOS was the king of operating systems.
Software development was slower, and Macs, while better, were also much pricier than PCs.
UNIX was growing, but at that time in its history, the source code was jealously guarded and
expensive to use. Linus Torvalds was a Helsinki university student who liked playing around with
software and computers, and in 1991 he announced the creation of a new core operating
system that he had named Linux. It is now one of the most used systems for the PC and is
particularly suitable for businesses with small IT budgets. Linux is free to use and install, and is
more reliable than almost all other systems, running for many months and even years without a
reboot being necessary.
Directory Related Commands

1. Cd : Use cd to change directories. Type cd followed by the name of a


directory to access that directory. Keep in mind that you are always in a
directory and can navigate to directories hierarchically above or below.
Ex:cd games . If the directory games is not located hierarchically below the
current directory, then the complete path must be written out. Ex:cd
/usr/games . To move up one directory, use the shortcut command. Ex:cd ..
Use cp -r to copy a directory and all of its contentsType cp -r followed by
the name of an existing directory and the name of the new directory. Ex:cp
–r testing newdir You must include the -r or you’ll see the following
message: cp: testing is a directory and -r not specified.This command
saves you time if you need to make a mirror image of a directory packed

2. mkdir : Use mkdir to make/create a brand new directory Type mkdir


followed by the name of a directory. Ex: mkdir testdir with files.

3. mv : Use mv to change the name of a directory Type mv followed by the


current name of a directory and the new name of the directory. Ex: mv
testdir newnamedir

4. pwd : Trying to find out where on your Linux server you currently are
located? The pwd (print working directory) command will show you the full
path to the directory you are currently in. This is very handy to use,
especially when performing some of the other commands on this page!

5. rmdir : Use rmdir to remove an existing directory (assuming you have


permissions set to allow this). Type rmdir followed by a directory's name to
remove it. Ex:rmdir testdir
FILE COMMANDS

1. touch : touch is actually a command we may use to modify the access and
modification times on a file (normally not needed but sometimes when
you're testing a system that relies on file access or modification times it can
be useful). I know some students have tried using this command to make it
look like their assignment files were not modified after the due date (there
are means to detect this so it never works but points for being creative).
What we are taking advantage of here is that if we touch a file and it does
not exist, the command will do us a favor and automatically create it for us

2. cp : When we use cp the destination can be a path to either a file or


directory. If it is to a file (such as examples 1, 3 and 4 above) then it will
create a copy of the source but name the copy the filename specified in
destination. If we provide a directory as the destination then it will copy the
file into that directory and the copy will have the same name as the source.

3. rm : Like several other commands introduced in this section, rm has


several options that alter it's behaviour. I'll leave it up to you to look at the
man page to see what they are but I will introduce one particularly useful
option which is -r. Similar to cp it stands for recursive. When rm is run with
the -r option it allows us to remove directories and all files and directories
contained within.
4. mv : Normally mv will be used to move a file or directory into a new
directory. As we saw on line 4 above, we may provide a new name for the
file or directory and as part of the move it will also rename it. Now if we
specify the destination to be the same directory as the source, but with a
different name, then we have effectively used mv to rename a file or
directory.
MANAGING GROUPS AND USERS IN LINUX

1. useradd : Command to add new user on system. This command can be


as short as just one argument of userid. When run with just userid as
argument then it takes all default values for creating that user as
defined in /etc/default/useradd file. Or else number of options can be
specified which defines parameters of this new user while creation.
2. userdel : As name suggests its a command to delete users. It has only
two options –
-r : Remove user’s home_dir & mail spool
-f : Removes user even if he/she logged in. Removes home_dir, mail
spool & group of same name even these are being shared by another
users. Dangerous!If none of the options used and command just ran
with userid argument. It will only removes user from system keeping its
home_dir, mail spool and group

3. usermod : This command used to modify user parameter which we


seen in useradd command. All paramter options with useradd command
compatible with this command. Apart from those options it support below
ones –

-l new_login : Change login name to different. You have to manually


rename home_dir

-L : Lock account. Basically it puts ! in front of encrypted


password in passwd or shadow file.

-U : Unlock account. It removes !

-m new_home : Moves home_dir to new_dir. -d is mandatory to use with it.


4.groupadd : The groupadd command creates a new group account
using the values specified on the command line plus the default values
from the system. The new group will be entered into the system files as
needed.
5. groupmod : The groupmod command modifies the definition of the
specified GROUP by modifying the appropriate entry in the group
database.

6. groupdel command modifies the system account files, deleting all


entries that refer to group. The named group must exist. You mus

manually check all file systems to insure that no files remain with the

named group as the file group ID

7. passwd : is used to change the password of a user account. A normal


user can run passwd to change their own password, and a system
administrator (the superuser) can use passwd to change another
user's password, or define how that account's password can be used or
changed.

8. sudo : command allows you to run programs with the security privileges
of another user (by default, as the superuser). It prompts you for your
personal password and confirms your request to execute a command by
checking a file, called sudoers, which the system administrator configures.
Using the sudoers file, system administrators can give certain users or
groups access to some or all commands without those users having to know
the root password. It also logs all commands and arguments so there is a
record of who used it for what, and when.

9. su : command allows you to become another user. To use the su


command on a per-command basis, enter:
su user -c command
Replace user with the name of the account which you'd like to run the
command as, and command with the command you need to run as another
user. To switch users before running many commands, enter:
su user
Replace user with the name of the account which you'd like to run the
commands as.
The user feature is optional; if you don't provide a user, the su command
defaults to the root account, which in Unix is the system administrator
account. In either case, you'll be prompted for the password associated
with the account for which you're trying to run the command. If you supply
a user, you will be logged in as that account until you exit it. To do so, press
Ctrl-d or type exit at the command prompt.

FILE PERMISSION COMMANDS

1. chown : Now that you can list permissions, you surely want to mess up
with them. Chown is the first command we’re going through. It is used
to change the owner (or user subject)
2. Chmod : is probably the most difficult command among the three
presented in this post. It is used to change the permissions of the three
subjects

RESTORING AND COMPRESSION FILE COMMANDS


Tar : stores and extracts files from a tape or disk archive.
The first argument to tar should be a function; either one of the letters
Acdrtux or one of the long function names. A function letter need not be
prefixed with ``-'', and may be combined with other single-letter
options. A long function name must be prefixed with \-\- Some options
take a parameter; with the single-letter form these must be given as
separate arguments. With the long form, they may be given by
appending = value to the option.

You might also like