- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Regarding unix commands
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 11:46 PM
08-16-2006 11:46 PM
-r-xr-xr-x 2 scc scc 1286492 Aug 12 12:48 acego
1. I am able to see acego has 2 links. I don't know whether it's a soft or hard link. How do i find the link which is pointing for acego.
2. I am unable to see the year value in the listing. Only "Aug 12 12:48" i am able to see. How do i find the year in which the file is created.
3. I tried to create a directory and delete a directory from a different directory location but i am getting an error
mkdir $HOME/test1
rmdir $HOME/test1
rmdir: /home/users/fcc/test1: Cannot remove mountable directory
4. ls -ltr Back*
-rw-r--r-- 1 fcc fcc 1692 Aug 17 05:27 Backout.sh
I want to write a shell script in which i want to check the permission of Backout.sh is 644 and owner is fcc and group is fcc. I tried this one
ls -ltr Backout.sh | grep scc >> /tmp/backouterr.log
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 11:52 PM
08-16-2006 11:52 PM
Re: Regarding unix commands
3. will depend on that's the o/p of $HOME/test1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 11:54 PM
08-16-2006 11:54 PM
Re: Regarding unix commands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 11:58 PM
08-16-2006 11:58 PM
Re: Regarding unix commands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 12:00 AM
08-17-2006 12:00 AM
Solution1. ll
2. If it doesn't show a year, its this year. ie less than a year old.
3. You are in an nfs home directory and trying to remove things you don't have permission for. This may be due to NFS configuration.
PERM-$(ll Backout.sh | awk '{print $1}')
OWNER-$(ll Backout.sh | awk '{print $2}')
GROUP-$(ll Backout.sh | awk '{print $3}')
Make and if statement to let you know when you are not happy with the results from these commands.
ll can be replaced with ls -la with no impact.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 12:10 AM
08-17-2006 12:10 AM
Re: Regarding unix commands
permission=`ll Backout.sh | awk '{print $1}'`
if [ $permission = "-rw-r--r--" ]
then
echo "mask of permission is 644"
else
echo "Wrong permission"
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 12:18 AM
08-17-2006 12:18 AM
Re: Regarding unix commands
2. As mentioned, the ll command changes format to include the year when the file is more than 6 months old. Use the command: man ll
3. The $HOME directory is probably an NFRS mountpoint and you do not have permission to change that directory. To see if $HOME is an NFS mountpoint, bdf $HOME
4. I'm not sure how your request to check permissions and ownership relates to the example you gave. Converting the symbolic permissions (-rw-r--r--) to a number requires a lot of scripting code but comparing the permission string in its symbolic form is easy. You can extract the 1st, 3rd and 4th fields from ll like this:
ls -ldtr Back* | while read PERM LINK OWN GRP RESTOFLINE
do
echo "perm= $PERM, owner= $OWN group= $GRP $RESTOFLINE"
done
Note the use of -d in the ls command. In case the ls command finds a directory, the -d keeps the listing to jsut the directory and not the contents.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 12:27 AM
08-17-2006 12:27 AM
Re: Regarding unix commands
1. Since you have a link count that is greater than one (1) this is a hard-link. Too, soft (symbolic) links will have an "l" (the letter) as the first character of the first field returned by a 'ls' listing. See the manpages for 'ls(1)'.
2. The output of 'ls' shows the month, day, hour and minute of timestamps *unless* the file is 6-months or more old. In that case, the hours and minutes are replaced with the four-digit year value. Thus, any file timestamp showing hours and minutes belongs to the current calendar year.
Unix does *not* maintain any creation timestamp. The default output for 'ls' is the *modification* time or 'mtime'. When a file is first created, the 'mtime' is equal to the creation time, but thereafter any modifications are tracked using the single timestamp. Read the manpages for 'stat(2)' to understand the three timestamps associated with files.
3. The message "cannot remove mountable directory" means that you have 'cd'ed into the directory that you are trying to remove. You cannot remove a directory into which you have changed. This would be like standing on a ladder and kicking it out from underneath yourself!
4. You can use 'ls filename' and 'cut' or 'awk' to extact the permissions (mode) field along with the owner to compare for what you want. For instance:
# MODES=`ls -l /tmp/me|cut -d" " -f1`;echo ${MODES}
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 01:59 AM
08-17-2006 01:59 AM
Re: Regarding unix commands
ls -li acego (inode will be the first field)
find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 07:44 PM
08-17-2006 07:44 PM
Re: Regarding unix commands
drwxrwxrwt 2 fcc fcc 1024 Aug 16 23:20 cdd
what this final t in the permission stands for and what is it purpose. I want to create a new directory and set the same permission as of cdd. what permission in the chmod command i need to give for this one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 10:20 PM
08-17-2006 10:20 PM
Re: Regarding unix commands
You asked what the significance of the "t" is in "drwxrwxrwt".
The "t" indicates that the "sticky bit" is set. If the sticky bit is set for a directory, then the directory's files can only be renamed or removed by the owner of the file, the owner of the directory, or by root.
If the sticky bit is set for an executable file, then the text (code) of the executable remains in memory for subsequent executions. This may make process startup for the executable faster.
In the case of your directory, you would have obtained these modes with:
# chmod 1777 cdd
See the manpages for 'chmod(1)' for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2006 07:03 PM
09-06-2006 07:03 PM