SFTP commands

CommandDescription
?List of all commands or explain a command, eg ? get
!Leave the environment temporarily *
cdChange the active directory path on the remote host
chmodChange the permissions of files on the remote host
chownChange the owner of files on the remote host
dirList the contents of the current directory on the remote host
exitClose the connection and leave SFTP
getCopy a file from the remote host to the local computer
helpSame as ?
lcdChange the active directory on the local system
llsList the contents of the current directory on the local computer
lmkdirCreate a directory on the local computer
lnCreate a symbolic link for a file on the remote host
lpwdShow the present working directory on the local computer
lsSame as dir
lumaskChange the local umask value
mkdirCreate a directory on the remote host
putCopy a file from the local computer to the remote host
pwdShow the present working directory path on the remote host
quitSame as exit
renameRename a file on the remote host
rmDelete a file on the remote host
rmdirRemove an empty directory on the remote host
symlink             Same as ln
versionShow the SFTP version

Crontab: Awesome Cron Job Examples

Cron utility is an effective way to schedule a routine background job at a specific time and/or day on an on-going basis.

Linux Crontab Format

MIN HOUR DOM MON DOW CMD
Table: Crontab Fields and Allowed Ranges (Crontab Syntax)
Field Description Allowed Value
MIN Minute field 0 to 59
HOUR Hour field 0 to 23
DOM Day of Month 1-31
MON Month field 1-12
DOW Day Of Week 0-6
CMD Command Any command to be executed.

1. Scheduling a Job For a Specific Time

The basic usage of cron is to execute a job in a specific time as shown below. This will execute the Full backup shell script (full-backup) on 10th June 08:30 AM.

Please note that the time field uses 24 hours format. So, for 8 AM use 8, and for 8 PM use 20.

30 08 10 06 * /home/ramesh/full-backup
  • 30 – 30th Minute
  • 08 – 08 AM
  • 10 – 10th Day
  • 06 – 6th Month (June)
  • * – Every day of the week

2. Schedule a Job For More Than One Instance (e.g. Twice a Day)

The following script take a incremental backup twice a day every day.

This example executes the specified incremental backup shell script (incremental-backup) at 11:00 and 16:00 on every day. The comma separated value in a field specifies that the command needs to be executed in all the mentioned time.

00 11,16 * * * /home/ramesh/bin/incremental-backup
  • 00 – 0th Minute (Top of the hour)
  • 11,16 – 11 AM and 4 PM
  • * – Every day
  • * – Every month
  • * – Every day of the week

3. Schedule a Job for Specific Range of Time (e.g. Only on Weekdays)

If you wanted a job to be scheduled for every hour with in a specific range of time then use the following.

Cron Job everyday during working hours

This example checks the status of the database everyday (including weekends) during the working hours 9 a.m – 6 p.m

00 09-18 * * * /home/ramesh/bin/check-db-status
  • 00 – 0th Minute (Top of the hour)
  • 09-18 – 9 am, 10 am,11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm
  • * – Every day
  • * – Every month
  • * – Every day of the week

Cron Job every weekday during working hours

This example checks the status of the database every weekday (i.e excluding Sat and Sun) during the working hours 9 a.m – 6 p.m.

00 09-18 * * 1-5 /home/ramesh/bin/check-db-status
  • 00 – 0th Minute (Top of the hour)
  • 09-18 – 9 am, 10 am,11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm
  • * – Every day
  • * – Every month
  • 1-5 -Mon, Tue, Wed, Thu and Fri (Every Weekday)

4. How to View Crontab Entries?

View Current Logged-In User’s Crontab entries

To view your crontab entries type crontab -l from your unix account as shown below.

BRTOOLS Upgrade

#! /usr/bin/ksh
# Script for brtoolsupdate

su – <SID>adm -c brtools -V >> brtools.log

print

print “*************Check the Existing BRTOOL version******** ”
awk ‘/kernel release/’ brtools.log
awk ‘/patch level/’ brtools.log >> sversion.log
a=$(awk -F ‘/patch level /’ | awk ‘{print $3}’ sversion.log)
rm brtools.log
rm sversion.log
print “source patch level $a”
print “****************************************************** ”

print “Do you want to upgrade BRTOOLS version :”
print “1=Yes”
print “2=No”
print -n “Enter Your Choice:”
read value
mount jostname:/cddumps /cddumps

if (($value == 2))
then
print “BYE BYE..”
fi
if (($value == 1))
then
print -n “Enter the latest DBATL**********.SAR file as input:”
read brtools
file=/cddumps/KERNEL/DBATL740/$brtools

if [ ! -f $file ];
then
print “File not exit re-execute the script with correct file name:”
else

print
print “****mentioned file located in the directory $file ”
print

mkdir /sapbin/temp
cd /sapbin
chmod 777 temp
cd temp
cp -rp /cddumps/KERNEL/DBATL740/$brtools .
/sapmnt/<SID>/exe/uc/rs6000_64/SAPCAR -xvf $brtools >> extract.log
rm $brtools
rm extract.log
./brtools -V >> Tversion.log
awk ‘/patch level /’ Tversion.log >> Tversion1.log
b=$(awk -F ‘/patch level /’ | awk ‘{print $3}’ Tversion1.log)
rm Tversion.log
rm Tversion1.log

print
print “Source Version is:$a”
print “Target Version is:$b”

if (($b>$a));
then

chown <SID>adm:sapsys *
chown ora<SID>:dba brspace brbackup brrecover brarchive brconnect brrestore sapdba_role.sql
chmod 755 *
chmod 4755 br*
cp -rp * /usr/sap/<SID>/DVEBMGS00/exe/
cp -rp * /sapmnt/<SID>/exe/uc/rs6000_64/
cp -rp sapdba_role.sql /oracle/<SID>
sh /usr/sap/<SID>/DVEBMGS00/exe/saproot.sh <SID> >rootsh.log
rm rootsh.log
sh /sapmnt/<SID>/exe/uc/rs6000_64/saproot.sh <SID>
cd /sapbin
rm -r temp
print

#print “DBA Tools copied into respective kernel directories continue to execute import SAPDBA access to SR3 schema : ”
#read
su – ora<SID> -c sqlplus /nolog @sapdba_role.sql SR3

su – <SID>adm -c brtools -V >> brtools.log

print

print “*************Check the Existing BRTOOL version******** ”
awk ‘/kernel release/’ brtools.log
awk ‘/patch level /’ brtools.log
rm brtools.log
print “********************************************************** ”

print “#####BRTOOLS successfully updated and imported SAPDBA access to SR3 schema##### :”
#fi
#fi

else

cd /sapbin
rm -r temp

print
print “***** Script Terminated due to target version is lower than or equal to source version*****”
print
fi
fi
fi

Kernel Upgrade

# /usr/bin/ksh
# Script for kernel upgrade

#Check the existing kernel version
#variables
d=$(date +%d%m%y)
su – <sid>adm -c disp+work >>kernel.log
print
print “*************Check the Existing Kernel Release and Patch version******* ”
print
awk ‘/kernel release/’ kernel.log
awk ‘/patch number/’ kernel.log
awk ‘/kernel release/’ kernel.log >> kversion.log
awk ‘/patch number/’ kernel.log >> pversion.log
a=$(awk -F ‘/kernel release /’ | awk ‘{print $3}’ pversion.log)
k=$(awk -F ‘/kernel release /’ | awk ‘{print $3}’ kversion.log)
print
print “*********************************************************************** ”
rm kernel.log
rm pversion.log
rm kversion.log
print “Source Patch Level $a”
print “Source Kernel Level $k”
print

#Check to continue to upgrade kernel version;
print “Do you want to upgrade Kernel version :”
print “1=Yes”
print “2=No”
print -n “Enter Your Choice:”
read value
mount hostname:/cddumps /cddumps
#Check input of directory valid or not, if valid script executes

if (($value == 2))
then
print “BYE BYE..”
fi
if (($value == 1))
then
#print “\033[4m ”

print “\033[4m “”\033[33m Note:Kindly ensure copying the correct Kernel directory folder as it wont check the target version”
print “\033[0m ”

print -n “Enter the latest KER7**_***_** directory as input:”
read kernel
file=/cddumps/KERNEL/$kernel
if [ ! -d $file ];
then
print “File not exit re-execute the script with correct file name:”
else
print
print “****mentioned file located in the directory $file ”
print
print “Sit back Relax and enjoy the automation process”

#Extraction of kernel and setting permissions;
mkdir /sapbin/Kernel
cp -rp $file/*.tar /sapbin/Kernel/
cd /sapbin/Kernel
tar -xvf *.tar >>tar.log
rm *.tar
rm tar.log
chown -R <sid>adm:sapsys /sapbin/Kernel
chmod -R 755 /sapbin/Kernel

#Check the directory or SAPEXE version

su – <sid>adm -c env | grep SAPEXE >> SAPEXE.log
sed ‘s/=/ /g’ SAPEXE.log >> sapexe.log
b=$(awk -F ‘/SAPEXE/’ | awk ‘{print $2}’ sapexe.log)
rm SAPEXE.log
rm sapexe.log
#Copy existing Kernel into kerbak folder
tar -cvf /sapmnt/<SID>/kerbak/ker”$k”_ext”$a”_”$d”.tar /sapmnt/<SID>/exe/uc/rs6000_64 >> tarexe.log
rm tarexe.log

#Check to continue to shutdown oracle and sap application.
print “Do you want to continue to shutdown sap and oracle application to continue upgrade Kernel version :”
print “1=Yes”
print “2=No”
print -n “Enter Your Choice:”
read value

#Check input of directory valid or not, if valid script executes

if (($value == 2))
then
print “BYE BYE..”
fi
if (($value == 1))
then
# Script for shutting down all services of <sid>
su – <sid>adm -c stopsap all
su – <sid>adm -c sapcontrol -nr 00 -prot NI_HTTP -function StopService
su – <sid>adm -c sapcontrol -nr 01 -prot NI_HTTP -function StopService
/usr/sap/hostctrl/exe/saphostexec -stop pf=/usr/sap/hostctrl/exe/host_profile
su – daaadm -c stopsap all
su – daaadm -c sapcontrol -nr 98 -prot NI_HTTP -function StopService
/usr/sap/hostctrl/exe/saposcol -k
su – ora<sid> -c lsnrctl stop LISTENER_<SID>

#check sap process running or not
ps -aef | grep sap >> sap.log
p=$(wc -l < sap.log)
ps -aef | grep ora >> ora.log
q=$(wc -l < ora.log)
print “SAP Process runnning : $p”
print “Oracle Process running :$q”
rm sap.log
rm ora.log

while [ “$p” -gt 0 ] || [ “$q” -gt 3 ]; do
print “Some SAP or Oracle process running,open new session kill process manually and continue”
read
done
fi
fi
fi

Script for Tape output

#! /usr/bin/ksh
# System hostname rmt tape details
d=$(date +%d%m%y)
b=$(hostname)
lsdev -Cc tape >> lrdevtape.txt
a=$(awk ‘{print $1}’ lrdevtape.txt)
print “\033[33m Tape details of Server : $b on $(date) \033[0m ” >> “$b”_”$d”.txt
print >> “$b”_”$d”.txt
lsdev -Cc tape >> “$b”_”$d”.txt
print >> “$b”_”$d”.txt

print “$a” >> aoutput.txt
chmod 777 aoutput.txt lrdevtape.txt
for file in $(cat /sapbin/scripts/aoutput.txt)
do

lscfg -vpl $file >> “$b”_”$d”.txt
done
rm lrdevtape.txt aoutput.txt

print “rmt tape details updated in file “$b”_”$d”.txt “

File System (FS)

A directory is a unique type of file that contains only the information needed to access files or other directories. As a result, a directory occupies less space than other types of files.

File systems consist of groups of directories and the files within the directories. File systems are commonly represented as an inverted tree. The root directory, denoted by the slash (/) symbol, defines a file system and appears at the top of a file system tree diagram.

Some of the most important system management tasks have to do with file systems, specifically:

  1. Allocating space for file systems on logical volumes
  2. Creating file systems
  3. Making file system space available to system users
  4. Monitoring file system space usage
  5. Backing up file systems to guard against data loss if the system fails
  6. Maintaining file systems in a consistent state

    FileSystem

Note:The maximum number of logical partitions per logical volume is 32,512.For more information on file system logical volume characteristics,see the chlv command.

AIX supports four file system types:

jfs Journaled File System which exists within a Logical Volume on disk
jfs2 Enhanced Journaled File System which exists within a Logical Volume on disk
cdrfs CD-ROM File System on a Compact Disc
nfs Network File System accessed across a network
udfs Universal Disk Format (DVD ROM media)
gpfs General Parallel Filesystem
smbfs Server Message Block Filesystem (cifs_fs, samba share)

File System Commands :-

crfs→Create a file system. This command can be used to create a file system on an existinglogical volume, or it can be used as an all in one command to create both a logical volume and file system at once.

chfs → Change file system characteristics. This can be used to increase the size of a file system.

rmfs →Remove a filesystem, its associated logical volume, and its entry in /etc/filesystems.

crfs:- Its purpose is to add a file system. The crfs command creates a file system on a logical volume within a previously created volume group. A new logical volume is created for the file system unless the name of an existing logical volume is specified using the -d. An entry for the file system is put into the /etc/filesystems file.

You can use the File Systems application in Web-based System Manager (wsm) to change file system characteristics. You could also use the System Management Interface Tool (SMIT)smit crfs fast path to run this command.

Notes: The file system is created with the setgid (set group ID) bit enabled. This determines the default group permissions. All directories created under the new file system will have the same default group permissions.

CREATE NEW FILESYSTEM IN 8 STEPS:

Get the new disk allocated from SAN.

    1. Backup the existing disks details.
      #lspv > /disk_before
      #lspv |wc -l
    2. Scan for new LUN.
      #cfgmgr
    3. Identify the new disk device name. Keep note the disk name such as hdisk13
      #lspv |wc -l
      #lspv > /disk_new
      #diff /disk_before /disk_new
    4. Create new VG named “appdata” with PP (physical partition) size of 512MB.
      #mkvg –y appdata –s 512 hdisk13
    5. If it reports error like disk belongs to another volume group. Do recheck the device name and try force (-f) option. It happens when we reuse old disks
      #mkvg –f –y appdata –s 512 hdisk13
    6. Validate the VG created newly. Ensure total and free PP’s counts are as expected.
      #lsvg appdata
    7. Create  a logical volume of app1_lv with jfs2  in volume group and assigned allocating space
      mklv -y app1lv -t jfs2 appdata 160
    8. Create JFS2 filesystem and mount point (/opt/app1).
      #crfs –v jfs2 –d app1lv –m /opt/app1 –A yes -p rw
      #lsvg –l appdataNote
      -A – enable or disable automount upon reboot.
      -d – device name (LV name alone). No need to specify VG like we do in Linux.
    9. Mount the filesystem.
      #mount /opt/app1
      #df –gt

AIX – Boot Process

Three phases available in BOOT Process
1. Ros kernel init phase
2. Base Device Configuration
3. System boot phase
1. Ros Kernel init phase (PHASE1)
A. Post (power on self test)
In this post it will do basic hardware checking
B. Then it will go to NVRAM and check the boot list for last boot device (hdisk0 or hdisk1).
C. Then it will check the BLV (hd5) in boot device.
D. Then it will check the boot image
E. Then boot image is moved to memory.
F. Then kernel will execute.
2. Base Device configuration (PHASE2)
A. Here cfgmgr will run for device configuration.
3. System Boot Phase (PHASE3)
A. Kernel will execute.
B. The paging space (hd6) will get start.
C. Then following file system will be mounted /, /var. /usr, /home. /tmp
D. Kernel start the init process, it will read the /etc/inittab file and execute the following process.
/etc/rc.boot,
srcmstr
/etc/rc.tcpip
/etc/rc.net
The above network related files /etc/rc.tcpip, /etc/rc.net, used to configure the ip address and routing.
E. Then it will start the system by default run level 2.
NOTE:
Run level 2: It contains all of the terminal process and daemons that are run in the multi user
environment. This is default run level.
/etc/inittab file contains four fields, 1. Identifier, 2. Command, 3. Action, 4. Runlevel

Aix Prepared Commands

column numbers
:set nu in vi editor
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Listing of files:

ls -lt | more : list of files, sort by date
ls -lR | more : list of files including sub directories (recursive mode).
ls -l | sort +4nr | more : List of files sort by size
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Space administration

df -g : same as above but with more details./Current filesystem usage./ List of file with current utilization including sub directories/List of files with size in the current directory

Create / Copy / Move / ftp files:

vi : Edit / change the file content. And also the same command is used for creating the new file.
mv : move a file from one location to other or same location. Ex. (mv abc.txt pqr.txt)
(mv /home/abc.txt /home/Q47/abc.txt. Be careful while running this command.
cp : Make a copy of a file from one location to other or same location. Ex. (cp abc.txt
pqr.txt) (cp /home/abc.txt /home/Q47/abc.txt. Be careful while running this command.
 quit : To close the connection to the remote machine
*************************************************************************************
FTP:
ftp : Copy local files from windows machine to Unix server. Ex. below:
Will prompted user name and password and then it will connect to the UNIX server.
bin : Enable the binary mode.
hash : Enable the (#) mode.
lcd local_directory_name:When transferring files from the remote machine to the local machine
get remotefile localfile: To transfer a file from the remote machine to your local machine,
mget *.com:FTP allows for multiple file transfers using pattern matching by using the mget and mput commands
mput *.com
For both mput and mget, you will be asked to respond Y or N for each file that matches the pattern. If you do not want to go through this prompting process, you can disable PROMPT by entering the command at the FTP prompt:
      prompt off
or:
      toggle prompt
**********************************************************************************
###To see a list of available FTP commands, enter the command at the FTP prompt:###
      ? or help

####To see a list of files available in the working directory on the remote machine, enter the command:
      dir

put

General Commands:

last : List of the users who logged into the system, ordered by current date.
topas : List of process which are using high CPU, memory etc
date : today’s date.
tail -f : Will show the last few lines of the file, and also will update if the file is being modified.
tail – : same as above but will display the lines which you have mentioned in the option. Ex. tail -100 .
pwd : show current directory.
uptime : System Uptime, from when the system is up.
ps -eaf | grep : Process are running with the Ex. ps -eaf | grep oraw : currently logged on users.
whoami : Show which user you are logged in.
env : Show environment variables.
echo $ : Show the variable output. Ex. echo $ORACLE_HOME.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Useful commands while working with SAP under UNIX:

dpmon : Work process list at OS level as SM50.
Jsmon : java process list at OS level
disp+work -V | more : Current version of the disp+work file.
R3trans -d : Check whether the R/3 is able to connect to the DB, the log will be generated at OS level in same directory as
“trans.log”.
R3trans -x : Check whether the R/3 is able to connect to the DB, the detailed log will be generated at OS level in same
directory as “trans.log”.
tp connect : Check whether the tp is able to connect to the DB or not.
SAPCAR -xvf : Uncar the SAR/CAR files.
Use the adm for SAP related activity.
Use the ora for oracle related activity.
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
General purpose utilities:
1. what is the command to get the calendar?
cal / cal [ [ Month ] Year ]
2. what is the command to get the date?
Date
3. Displaying the message which we had given?
Echo
4. what is the command for the calculator?
Bc
5. To record the session?
Script
6. To change the password?
Passwd
7. To get the users?
Who
8. To get the terminal characteristics?
Tty
9. displaying and setting the terminal characteristics?
Sty
#######################################################################
File oriented commands:
What is the command to list out the contents?
ls –l
what is the command to get the hidden files(.,..)?
ls –a
what is the command to get the files in category wise(flagged)?
ls –f
what is the command to get the directory attributes?
Ls –ld Eg: $ ls –ld rajesh
in ls -l what is the first character indicates?
drwxr-xr-x 2 mgurumur staff 1024 May 10 15:07 temp
Type of the files
file
d-directory
c-char file

what is the command to create a file?
Cat > file name
How to append the content to an existing file?
Cat >> file name
what is the end of file indicator?
Ctrl d
How to concatenate two files
Cat file1,file2>file 3.
How to remove a file?
Rm
While removing how to get the prompt for the removal{interactive remove}
Rm –I
What is the command for recursive file delete?
Rm –r.
What is the difference between “
cat ” and “
cat > file name”
First command displays the content of the file
Second command creates the file

What is the use of “more” command.
To get the contents page wise
What is that command to copy a file and link a file.
cp sample1 sample2 – for copying sample1 to sample2
ln sample1 sample2 – for linking sample1 and sample2 ·
What is the difference between linking and copying files.
linking – links two or more files. Does not create another copy of the file. Changes in one file, gets reflected in all the linked files
copy – creates separate files , changes in one is not reflected in others.
How to find the total number of characters in a file
wc -c ·
To get the type of the file?
File
Eg: file chap01
Comparing two files?
Cmp
Eg: $cmp file1 file2———–prints the first mismatch(character and the line)
File1 file2 differ: char 9, line 1
To get the common content in two files
comm.
Eg: comm file1 file2 – prints the common content in both the files

To get the difference in two files and converting one file to other
diff
eg: diff file1 file2
To compress and uncompress the files?
Gzip and gunzip
To make an archive?
Tar
converted

Compressing and archiving together?
Zip and unzip
How to change the permissions of a file
chmod
How to give the executable permission to the group?
Chmod g+x
What is the meaning of the command
chmod 777 {4-read,2 –write, 1-execute}
rwx for user
rwx for group
rwx for others

Commands to transfer the files remotely
ftp,rcp,scp
What is the difference between rcp and scp?
Rcp-remote copy-no profound authentication
Scp-secured copy-copied in a encrypted format, rate of transit is high
What is the syntax for Scp?
scp [options] [[user@]host1:]filename1 … [[user@]host2:]filename2
*************************************************************************************************************
Directory oriented commands:

1. what is the command to create a directory?
Mkdir
2. what is the command to change the directory?
ctrmc_MDdr.dbg
3. how to move to the parent directory?
cd..
4. how to get the current directory?
Pwd, echo $home
5. how to remove the directory?
Rmdir, rm –r
6.what is the difference between rmdir and rm –r?
inorder to use the rmdir command the directory should be empty.
The rm –r itself deletes the sub directories.
7. how to copy the entire directory structure?
Cp -R
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Process oriented and filters:

What are the basic filters available?

Grep, sed.
Grep “pattern”

How to count for pattern in a file
grep -c “pattern”
What is sed?
Sed is used as a multipurpose filter.
How to increment value of a variable
a=expr $a + 1
How to check for various processes that are running on a system
ps -ef
How will you execute a program so that it runs in the background
Program name &

How to bring background process to foreground
fg
=========================================================================
Vi editor commands:
STARTING vi
vi filename edit a file named “filename”
vi newfile create a new file named “newfile”
ENTERING TEXT
i insert text left of cursor
a append text right of cursor
MOVING THE CURSOR
h left one space
j down one line
k up one line
l right one space

BASIC EDITING
X delete character
Nx delete n characters
X delete character before cursor
Dw delete word

Ndw delete n words
Dd delete line
Ndd delete n lines
D delete characters from cursor to end of line
R replace character under cursor
Cw replace a word
ncw replace n words
C change text from cursor to end of line
o insert blank line below cursor
(ready for insertion)
O insert blank line above cursor
(ready for insertion)
J join succeeding line to current cursor line
nJ join n succeeding lines to current cursor line
u undo last change
U restore current line

MOVING AROUND IN A FILE
w forward word by word
b backward word by word
$ to end of line
0 (zero) to beginning of line
H to top line of screen
M to middle line of screen
L to last line of screen
G to last line of file
1G to first line of file
f scroll forward one screen
b scroll backward one screen
d scroll down one-half screen
u scroll up one-half screen
n repeat last search in same direction
N repeat last search in opposite direction

CLOSING AND SAVING A FILE
ZZ save file and then quit
:w save file
:q! discard changes and quit file
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
some aix commands;
1) df -g . =  displays the current directory file system only
2) du -sH = total space occupied in particular directory
3)du * = space occupied by each folder in the file system
4)

filesystem:
1)To check how much space your rootvg would have you use the following command.
lsvg
lsvg rootvg
2)Assign it to your file systems using the following command.
chfs -a size=+1G /home
3) who logged to the server
last | pg,last | more
4)

vi Editor Commands

General Startup
To use vi: vi filename
To exit vi and save changes: ZZ   or  :wq
To exit vi without saving changes: :q!
To enter vi command mode: [esc]

Counts
A number preceding any vi command tells vi to repeat
that command that many times.


Cursor Movement

h move left (backspace)

j move down

k move up

l move right (spacebar)

[return] move to the beginning of the next line

$ last column on the current line

0 move cursor to the first column on the
current line

^ move cursor to first nonblank column on the
current line

w move to the beginning of the next word or
punctuation mark

W move past the next space

b move to the beginning of the previous word
or punctuation mark

B move to the beginning of the previous word,
ignores punctuation

e end of next word or punctuation mark

E end of next word, ignoring punctuation

H move cursor to the top of the screen

M move cursor to the middle of the screen

L move cursor to the bottom of the screen

Screen Movement

G move to the last line in the file

xG move to line x

z+ move current line to top of screen

z move current line to the middle of screen

z- move current line to the bottom of screen

^F move forward one screen

^B move backward one line

^D move forward one half screen

^U move backward one half screen

^R redraw screen
( does not work with VT100 type terminals )

^L redraw screen
( does not work with Televideo terminals )

Inserting

r replace character under cursor with next
character typed

R keep replacing character until [esc] is hit

i insert before cursor

a append after cursor

A append at end of line

O open line above cursor and enter append mode

Deleting

x delete character under cursor

dd delete line under cursor

dw delete word under cursor

db delete word before cursor

Copying Code

yy (yank)’copies’ line which may then be put by
the p(put) command. Precede with a count for
multiple lines.

Put Command
brings back previous deletion or yank of lines,
words, or characters

P bring back before cursor

p bring back after cursor

Find Commands

? finds a word going backwards

/ finds a word going forwards

f finds a character on the line under the
cursor going forward

F finds a character on the line under the
cursor going backwards

t find a character on the current line going
forward and stop one character before it

T find a character on the current line going
backward and stop one character before it

; repeat last f, F, t, T

Miscellaneous Commands

. repeat last command

u undoes last command issued

U undoes all commands on one line

xp deletes first character and inserts after
second (swap)

J join current line with the next line

^G display current line number

% if at one parenthesis, will jump to its mate

mx mark current line with character x

‘x find line marked with character x

NOTE: Marks are internal and not written to the file.


Line Editor Mode
Any commands form the line editor ex can be issued
upon entering line mode.

To enter: type ‘:’

To exit: press[return] or [esc]

ex Commands
For a complete list consult the
UNIX Programmer’s Manual

SUBSTITUTION
:#,#s/old/new/g

# line number range

old pattern to replace

new pattern to insert

g optional key for global substitution
(multiple occurences of old on the same line
will not be replace without this)

READING FILES
copies (reads) filename after cursor in file
currently editing

:r filename

SUBSTITUTION
:#,#s/old/new/g

# line number range

old pattern to replace

new pattern to insert

g optional key for global substitution
(multiple occurences of old on the same line
will not be replace without this)
WRITE FILE

:w saves the current file without quitting

MOVING

:# move to line #

:$ move to last line of file


SHELL ESCAPE
executes ‘cmd’ as a shell command.

:!’cmd’