0% found this document useful (0 votes)
70 views38 pages

Unix For Sap Basis

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1/ 38

UNIX FOR SAP BASIS

CREATING AND DELETING FILES

• cat > filename


file will be created
• cat >> filename
append contents to existing file.
• touch file1 file2
no.of files will be created.
• rm filename
file will be deleted.
CREATING AND REMOVING DIRECTORIES

• mkdir dir1 dir2


no.of directories will be created.
• rmdir dir1 dir2
no.of empty directories will be deleted
• rm –rf dir1
it removes directories with contents.
• cd
to change one directory to another directory
• pwd
to know present working directory.
• ps –ef
to know all processes.
• kill pid
to kill particular process.
• kill –9 pid
to kill process forcefully.
• vi filename
to edit file in vi.
• ls filename
Lists all files and directories.
• ls –l
it gives full information of files and directories.
• ls –a
it displays hidden files
• ls –p
shows difference b/w files and directories.
• ls –i
Displys inode no of files and directories.
File permissions
We have two ways to assign permissions to
files
1. Numeric mode
2. Symbolic mode
Numeric mode

• We assign numerics to permissions like


read 4
write 2
execute 1
• chmod 777 filename/dirname
assign full permissions to all users.
• chmod 666 filename/dirname
it assigns read and write permissions to all users
• chgrp newgroupname file/directory
it changes groupname for file or directory.

• chown newownername file/directory


it changes owner for file or directory.
Symbolic mode
Here we assign symbols to users.
• owner u
• group g
• others o
• all a
• read r
• write w
• execute x
• adding permissions +
• removing permissions -
To assign permissions

• chmod ugo+rwx file/dir.

To remove permissions

• chmod ugo-rwx file/dir.


Network communication
In hetrogenous and homogenous environment

• telnet ipaddress
it connets to remote system
• ftp ipaddress
• scp /dir ipaddress:/dir
it copies date from source system to target
system
• ssh ipaddress:mkdir /dir
it executes commands in remote system.
Only in homogenous environment

• rlogin ipaddress

• rcp /dir ipaddress:/dir

• rsh ipaddress:rm /file


User commads
• useradd –u uid –g gid –G gid –d homedirecory
–m –s sh username
it adds user g for primary group
G for secondary group
d,m for homedirecoty
s for default shell
u user id
• su – username
to swith from one user to another user.
Users monitoring
• who
displays all users who are currently logged in system.
• who am I
displays detailed information about current logged in
user.
• last
displays information about when system is lastly
rebooted,who,time.
• finger
information about current logged in user.
• df
it displays all filesystems with sizes
• df –h
it displays all filesystems with human
readable form.
Shutdown commands

• shutdown
• init 0
like shutdown
• init 1
single user mode
• init 6
like reboot
• reboot
• poweroff
To copy a file
cp sourcefile targetfile
To copy empty directory
cp sourcedir targetdir
To copy directory with all contents
cp –r sourcedir targetdir
To move file
mv sourcefile targetfile
To move directory
mv sourcdir targetdir
• To link file or directory in same filesystem
ln soucefile/dir targerfile/dir
this is called hard mounting
• If you link souce file or dir with another file
which is in different file system that is
called soft mounting
ln –s sourcefile/dir targetfile/dir
• For help
man command
Pattern search
• To seach for a single word in a file
grep word filename
• it displays all lines which contains this
word
• To seach multiple words
egrep word1 | word2 filename
• To seach for a text
fgrep text filename
THANK YOU

You might also like