Wednesday, June 29, 2005

file commands

^^ How can I create a file of arbitrary size?

1. Method 1
1. /usr/sbin/mkfile 10m file
1. Creates a 10 Megabyte file
2. For each write() operation, there is no accompanying
read() operation, making this method very efficient
2. Method 2 (recommended)
1. /usr/bin/dd < /dev/zero > file bs=1024 seek=10240 count=1
1. Creates a 10 Megabyte file
2. This method does not require many reads and writes
since the file is sparse

# ^^ How do I archive directories with 155+ character directory names
or 100+ character file names?

1. Solaris 2.6
1. Sun's version of tar does not support this, use cpio
2. /usr/bin/find . | /usr/bin/cpio -o > file.cpio
1. -H tar produces warning on files with the
aforementioned attributes
2. Solaris 7 / 8 / 9 / 10
1. Use the -E switch to enable extended headers

^^ How do I get access, modify, creation time of a file?

1. Access time (atime)
1. /usr/bin/ls -ul filename
2. Modify time (mtime)
1. /usr/bin/ls -l filename
3. Creation time
1. There is no way to determine creation time in the ufs filesystem
4. Change time (ctime)
1. /usr/bin/ls -cl filename
2. this includes status changes (like permissions)
5. All in one (root)
1. /usr/bin/ls -i filename | /usr/bin/awk \ '{print
"0t"$1":ino?i"}' | /usr/sbin/fsdb -F ufs /dev/rdsk/c0t0d0s0
1. assumes raw device of filesystem for filename is c0t0d0s0

0 Comments:

Post a Comment

<< Home