How to modify the File Creation Time and query in Solaris
Lab Demonstration:
1. Check time
[[Email protected]:/] # date
Tue Jul 15 21:37:01 CDT 2014
-- If the time is incorrect, modify the format as follows:
[[Email protected]:/] # date 0715221114 -- July 15, 2014
Tue Jul 15 22:11:00 CDT 2014
2. Create an experiment environment
[[Email protected]:/] # mkdir Test
[[Email protected]:/] # cd Test
[[Email protected]:/test] # Touch test1
[[Email protected]:/test] # Touch Test2
[[Email protected]:/test] # mkdir dirtest1
[[Email protected]:/test] # mkdir dirtest2
[[Email protected]:/test] # ls
Dirtest1 dirtest2 test1 Test2
3. query the File Creation Time
-- This query shows the specific creation time.
[[Email protected]:/test] # ls-ll
Total 8
Drwxr-XR-x 2 root Root 2 Jul 15 dirtest1
Drwxr-XR-x 2 root Root 2 Jul 15 dirtest2
-RW-r -- 1 Root 0 Jul 15 test1
-RW-r -- 1 Root 0 Jul 15 Test2
Supplement:
-- Note that in a UNIX system, if the creation time is more than half a year, only the year is displayed and the specific time is not displayed, as shown below:
[[Email protected]:/] # ls-ll
Total 1063
Drwxr-XR-x 2 root Root 2 Feb 19 12:12 123
Lrwxrwxrwx 1 Root 9 Apr 24 2013 bin->./usr/bin
Drwxr-XR-x 8 root sys 11 Apr 24 2013 boot
Drwxr-XR-x 3 root nobody 4 Apr 24 2013 CDROM
Drwxr-XR-x 2 root Root 3 Feb 19 12:32 Desktop
Drwxr-XR-x 19 root sys 372 Jul 15 Dev
Drwxr-XR-x 4 root sys 12 Jul 15:22 Devices
Drwxr-XR-x 2 root Root 2 Apr 24 2013 documents
Drwxr-XR-x 88 root sys 244 Jul 15 etc
Drwxr-XR-x 2 root Root 2 Feb 14 17: 58 exercise
Drwxr-XR-x 3 root sys 3 Apr 24 2013 Export
Dr-XR-x 1 Root 1 Jul 15:22 home
Drwxr-XR-x 18 root sys 19 Apr 24 2013 Kernel
Drwxr-XR-x 8 root bin 243 Apr 24 2013 lib
Drwxr-XR-x 2 root sys 2 Apr 24 2013 mnt
Dr-XR-x 1 Root 1 Jul 15 :22 net
Drwxr-XR-x 5 root sys 5 Apr 25 2013 OPT
Drwxr-XR-x 5 root sys 5 Apr 24 2013 Platform
Dr-XR-x 91 Root 480032 Jul 15 proc
-RW-r -- 1 Root 32 Apr 24 2013 Profile
Drwxr-XR-x 4 Root 4 Apr 24 2013 rpool
Drwxr-XR-x 2 root sys 54 Apr 24 2013 sbin
Drwxrwxr-x 3 Oracle oinstall 3 Feb 18 19:50 Spool
Drwxr-XR-x 4 Root 4 Apr 24 2013 System
Drwxr-XR-x 4 Root 6 Jul 15 test
Drwxrwxrwt 6 root sys 532 Jul 15 TMP
Drwxrwxr-x 3 Root 3 Apr 24 2013 u01
Drwxr-XR-x 3 Root 3 Apr 24 2013 u02
Drwxr-XR-x 42 root sys 56 Apr 25 2013 USR
Drwxr-XR-x 44 root sys 44 Apr 24 2013 VaR
Dr-XR-x 6 Root 512 Jul 15 :22 vol
4. Modify the Directory and File Creation Time
[[Email protected]:/test] # ls-ll | grep dirtest1 -- view the Directory Creation Time
Drwxr-XR-x 2 root Root 2 Jul 15 dirtest1
[[Email protected]:/test] # Touch-T 200711011200.00 dirtest1 -- change the Directory Creation Time To, January 1, November 1, 2007
[[Email protected]:/test] # ls-ll | grep dirtest1 -- view the Directory Creation Time after modification. Because the creation time exceeds half a year, only the year is displayed.
Drwxr-XR-x 2 root Root 2 Nov 1 2007 dirtest1
[[Email protected]:/test] # ls-Atl test1 -- view the File Creation Time
-RW-r -- 1 Root 0 Jul 15 test1
[[Email protected]:/] # Touch-T 201406121200.00 test1 -- modify the File Creation Time to:, January 1, June 12, 2014
[[Email protected]:/] # ls-alt test1 -- view the modified time of the file, which is, January 1, June 12. This indicates that the modified File Creation Time has taken effect.
-RW-r -- 1 Root 0 Jun 12 12:00 test1
5. Summary
1. Use the touch command to modify the creation time, and run "# man touch" to view other touch commands;
2. For files that have been in UNIX systems for more than half a year, only the year is displayed during query.
**************************************** *******Statement************************************************
Original works, from "Deep Blue blog" blog, welcome to reprint, reprint please be sure to indicate the source (http://blog.csdn.net/huangyanlong ).
Please leave a message if the statement is incorrect. Thank you very much.
Reminder: Click the directory to view the directory.
*****************************************************************************************************