0% found this document useful (0 votes)
61 views7 pages

Differences Between su and sudo Commands

The document discusses the su and sudo commands and their differences. su allows switching to another user account without logging out, while sudo executes commands as another user. Both may require the password of the target account. Sudo is used to run individual commands, while su switches the active account.

Uploaded by

Nithesh Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views7 pages

Differences Between su and sudo Commands

The document discusses the su and sudo commands and their differences. su allows switching to another user account without logging out, while sudo executes commands as another user. Both may require the password of the target account. Sudo is used to run individual commands, while su switches the active account.

Uploaded by

Nithesh Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Q : can u please explain diffrence btwn su and sudo

su & sudo Commands

• Sometimes, you will need to log into another account without

logging out of the system

• There are two commands for this purpose – su, which is present

on all versions of Unix, and sudo, that may be not available

with all versions

• While using the commands, you might be asked for the password

of that account, unless you are the root user

• Running su by itself takes you to the root account

• When using su, you continue to use your environment variables

and profile. If you want to use the account’s user

environment, put a – between the su and the account name: su – amber

• sudo is used to execute commands as another user

---------------------------------------------------------

Q : can you explain about finger command unable to understand?

==> Finger command is a user information lookup command which gives

details of all the users logged in. This tool is generally

used by system administrators. It provides details like login name,

user name, idle time, login time, and in some cases their

email address even. This tool is similar to the Pinky tool but the

Pinky tool is just the lightweight version of this tool.

To install finger tool use the following commands as per your Linux distribution.

In case of Debian/Ubuntu

$sudo apt-get install finger


In case of CentOS/RedHat

$sudo yum install finger

================================================================

Q : what is the difference b/w absolute & relative paths

in the Linux command?

==> Absolute path : complete path of your file

example : cat /usr/share/dict/[Link]

==> Relative path : means the path of current folder

[Link]

---------------------------------------

Q : To view /etc/passwd i have to use sudo command along with the

cat command even if im working as a root user.

is it normal or have i messed something up?

==> To view /etc/passwd file not need of sudo previliges

Normal user can see the contents of /etc/passwd file with sudo

cat /etc/passwd

-------------------------------------------------------

Q : Can you Tell what are Environment variables?

==> Q : what is variable?

fname="Shankar"

lname="Gavkare"

echo "$fname"
echo "$lname"

----------------------------------------------------

Q : Environment Variable?

Open source system environment variable Name is PATH

==> The PATH variable contains a list of directories

the system checks before running a command.

Updating the PATH variable will enable you to run any

executables found in the directories mentioned in PATH

from any directory without typing the absolute file path.

system commands to check the user define and system define variables

commands are as follow

==> set

==> env

==> printenv

===============================================================

vim or vi editor

----------------

vi stand for

The vi editor is elaborated as visual editor.

The vi editor has three modes:

==>Command Mode: In command mode, actions are taken on the file.

The vi editor starts in command mode.

Here, the typed words will act as commands in vi editor.

To pass a command, you need to be in command mode.


Example :

press ESC key 1000dd esc

press ESC key 1000yy esc

press ESCkey p

==> Insert Mode: In insert mode, entered text will be inserted

into the file. The Esc key will take you to the command mode

from insert mode.

--------------------------------------------------------

Q : kill command ?

==> kill - terminate a process

==> -l, --list [number]

Print a list of signal names, or convert the given signal number

to a name.

-------------------------------------------------------------

Q : What is the difference between directory and file

==> In Linux/Open source every thing is file

==> A file is a chunk of data that contains information

such as text or binary data, like graphics and audio files.

There are many different formats of files for various

types of data. To handle these files, an operating system

will have a file system.

File is of type c:
b block (buffered) special

c character (unbuffered) special

d directory

p named pipe (FIFO)

f regular file

l symbolic link; this is never true if the -L option or the

-follow option is in effect, unless the symbolic link is

broken. If you want to search for symbolic links when -L

is in effect, use -xtype.

s socket

D door (Solaris)

-----------------------------------------------------------------

Q : What is a gpasswd command ?

==> gpasswd command is used to administer the /etc/group

and /etc/gshadow.

==> As every group in Linux has administrators, members, and a password.

It is an inherent security problem as more than one person

is permitted to know the password. However, groups can perform

co-operation between different users.

==> This command assigns a user to a group with some security criteria.

This command is called by a group administrator with a group

name only which prompts for the new password of the group.

-------------------------------------------------------------------

Q : sir what is the difference between cd. and cd .. command?

==> The cd command in Linux stands for change directory.

It is used to change the current directory of the terminal.


Arguments

The cd command accepts several types of arguments.

We will go through the most frequently used ones in this shot.

cd /

==> To go to the root directory, we input / as the argument.

cd

==> We do not provide any arguments to the cd command

to go to the home directory.

cd ..

==> To shift one level above the current directory,

we input .. as the argument.

cd -

==> To go to the previous directory, we use - as our argument.

cd /folder/subfolder

==> For custom navigation across any directory,

we can send its path as the argument.

-----------------------------------------------------------------------

Q : Can you explain chmod, setgid and setuid

==> Linux chmod command is used to change the access permissions

of files and directories. It stands for change mode.

It can not change the permission of symbolic links.

[Link]

--------------------------------------------------------------------

Q : what are symlinks and how are they realized using pwd ?

==> ls -l
ls -l /dev | grep ^l

ln - make links between files

-s, --symbolic

make symbolic links instead of hard links

ln -s filename

-----------------------------------------------------------------

Q : sir can u explain Process Id and INODE.

==> pid accociated with system call or process

==> INODE associated with file, it like address

Q : Some command are not running on git bash so what we have to do

==> please install it using yum or apt command

yum command for .rpm version like linux

apt or apt-get command for ubunti or .deb version

You might also like