Using Files
Using Files
cp source target
cp file1 file2 ... target_dir
To copy the file /home/team03/pgms/suba to /home/team01/doc
and name it programa:
$ pwd
/home/team01/doc
$ cp /home/team03/pgms/suba programa
doc doc
mon_report
trio_ltr mon_report
walrus programa
trio_ltr
walrus
© Copyright IBM Corporation 2010, 2013. All Rights Reserved.
US Government Users Restricted Rights - Use duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp
cp examples
IBM Power Systems
$ cd /home/team01
$ cp doc/programa test1 c
home home
team01 team01
.profile .profile
c doc manuals c manuals
doc
test1 test1
programa programa programa
test1
$ cd /home/team01/doc
$ cp trio_ltr ../c
home home
team01 team01
c doc c doc
trio_ltr trio_ltr trio_ltr
© Copyright IBM Corporation 2010, 2013. All Rights Reserved.
US Government Users Restricted Rights - Use duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp
Moving and renaming files
IBM Power Systems
mv source target
mv file1 file2 ... target_dir
$ pwd
/home/team01/c
$ mv trio_ltr t.letter
home home
team01 team01
c c
trio_ltr t.letter
$ pwd
/home/team01/c
$ mv t.letter ../doc/letter
home home
team01 team01
c doc c doc
t.letter trio_ltr trio_ltr
letter
$ pwd
/home/team01/c
$ mv ../doc/mon_report .
home home
team01 team01
c doc c doc
mon_report mon_report
$ cat walrus
"The time has come," the Walrus said,
"To talk of many things:
Of shoes - and ships - and sealing wax -
Of cabbages - and kings -
And why the sea is boiling hot -
And whether pigs have wings."
pg filename
more filename
$ pg walrus
Activity
ln source_file target_file
• Allows files to have more than one name in the directory structure.
• Both files reference the same i-node.
• Cannot be used with directories. Cannot span file systems.
$ ls –li
63 -rw-r--r-- 2 team01 staff 1910 Nov 21 14:19 man_files
$ ln man_files manuals
$ ls -li
63 -rw-r--r-- 2 team01 staff 1910 Nov 21 14:19 man_files
63 -rw-r--r-- 2 team01 staff 1910 Nov 21 14:19 manuals
ln –s source_file target_file
$ ln –s man_files manuals
$ ls -li
63 -rw-r--r-- 1 team01 staff 1910 Nov 21 14:19 man_files
66 lrwxrwxrwx 1 team01 staff 1910 Nov 21 14:19 manuals -> man_files
$ ls
mon_report trio_ltr walrus
$ rm mon_report
$ ls
trio_ltr walrus
$ rm –i walrus
rm: remove walrus?y
$ ls
trio_ltr
$ qprt walrus
$ qchk
Queue Dev Status Job Files User PP% Blks Cp Rnk
lp0 lp0 Running 99 walrus team01 1 1 1 1
$ qcan –x 99