General :: Stat Command To Print Permission In Octal Format?
Oct 11, 2009Is it possible to print the permission in octal format for a directory recursively?Code:
stat -c "%a" /etcIt prints the permission for /etc directory only.
Is it possible to print the permission in octal format for a directory recursively?Code:
stat -c "%a" /etcIt prints the permission for /etc directory only.
'ls -l' gives me the permissions in the long format - drwxr-xr-x format. Is there a way i can get the permissions in a form i can use in a bash script? the only form i can imagine of is the octal one... something like '755' for the above, but i dont know what would give me such an output.... are there other methods to consider while using (rather comparing) them in a script?
View 3 Replies View RelatedI have some files lying around in /root/bla/, all these files are 644 and /root/bla/ is 755. Still, when I try (as a different user) to cp /root/bla/file ., I get a "cp: cannot stat: Permission denied". I also cannot ls /root/bla/, I also get a Permission denied... what gives?
View 3 Replies View Relatedstat is (generously) giving twice the expected output:
Code:
c@CW8:/tmp$ touch foo
[code]...
i am not able to mount a pen drive (which is formatted in ext2 format) with directory permission drwxrwxrwx and file permission as -rw-rw-rw.
View 3 Replies View RelatedI'm writing a script that takes the date attribute of a file when it was created and appending it to the name. I'm pretty close to what I need, but the date appears in yyyy-mm-dd format and I want it to read mm-dd-yyyy. What I have done so far is something like
for ((i=1;i<=50;i++));
do fdate=`stat -c %y Video Snapshot $i.png|awk {'print$1'}`;
newname=Personname-$fdate-$i.png;
mv Video Snapshot $i.png $newname;
done
This works decently but the date comes out in the yyyy-mm-dd format. How do I change it?
I am creating a script to sync my important documents between two system. I want my script to generate a log file for the last action. can you suggest me a way to achieve this.Question: If I execute the rsync command with -v flag, it will print a lot of messages on the console. Is there any way. So, I can redirect these logs to a file?
View 4 Replies View RelatedI am looking for a way to print the timestamp of a directory using find command. I can do that for a file, but for a directory, it is printing the contents of the directory as well. Lets say there is a directory called doc, and there are more than one occurrences of that directory.
find . -name "doc" -type d -exec ls -l {} ;
This is printing the contents of all the files under doc directory as well.
i am running ps xo "pid,command" but I can't find my process in the results. I know that the process is running because I run ps ax | grep command-name
View 4 Replies View RelatedI have a script that is in Unix. I wanted to know is there any difference between output of ls command in unix and linux
In Unix
Code:
ls -ltr | awk '{print $9}'
In linux output is something similar to
Code:
drwxrwxrwx 2 vinay vinay 4096 2010-02-04 20:31 test
According to above output nothing will be displayed for
Code:
ls -ltr | awk '{print $9}'
ls -ltr | awk '{print $8}' will give test as ouptut in Linux.
I wanted to check the output format for ls -ltr, Anyone using Unix systems may paste a sample output of the command ls -ltr..
I want to know how to set time format (12 hrs or 24 hrs) using command.I tried thisode:date +%T -s "2011-02-23 14:00"But it only displays 24 hrs format on TERMINAL but it does not SET 24 hrs format on the system
View 4 Replies View RelatedHow can I give execute permission to chmod command from run level 3.Because in GUI mode we have the execute option in the properties of file. E.g. I gave following command
chmod -x chomod
After that I want to give the execute permission (x) to chmod command again but how from command prompt?
I am just trying to print the timestamp. which is not working.
#!/bin/bash
TSTAMP= date '+%d.%m.%y-%H:%M:%S'
echo "${TSTAMP}"
It is not displaying anything. What is wrong with the above commands.
I use to know this command but lost it and did not note the entire command on my Linux cheat sheet. Someone once showed me a simple very easy command I could use to simple format a USB flash drive as FAT32 and in the same command also name the label of the drive.I have the device /dev/sdc1 and I am formatting this as FAT32 so it's compatible across multiple systems but also want the drive to have the name 'my_usb'.
View 3 Replies View RelatedIf I try the sudo mv command on the file listed below I get the error listed. I am confused. It is my file & I have permissions. Somehow a slew of files on my system are now showing this way. This seems to correspond when I ran rsync from my netbook to sync it up with my desktop where I am having a problem.
Potential Source ->
sudo rsync -av --delete --rsh=ssh joe@192.168.1.4:/media/Abyss/Memories/ /home/joe/Pictures/
Type of issue ->
mv: cannot remove `100_2259.jpg': Permission denied
joe@Tux-Box:/media/Abyss/Memories/2009/3-09$ stat 100_2259.jpg
File: `100_2259.jpg'
Size: 243012 Blocks: 480 IO Block: 4096 regular file
Device: 811h/2065dInode: 1312030 Links: 1
Access: (0777/-rwxrwxrwx) Uid: (1000/joe) Gid: (1000/joe)
Access: 2010-07-17 11:41:26.708020712 -0400
Modify: 2009-12-13 21:49:59.501938000 -0500
Change: 2009-12-24 05:54:02.854309200 -0500
How to print a sequence of line say line number 10 to 20 of a 50 line file ?
View 6 Replies View RelatedI have a DLink 323 NAS with a USB port for a printer. Im trying to setup the printer. When I get to the part where I have to enter the username and password for the NAS, no matter what I put in for a password and username, I get the same error message (see attached screenshot). I can not get my network printer to work because of this.
View 7 Replies View RelatedI'd like to print only few groups from text matching a regex. How can I do that in the Linux command line?
What other tools for text processing are there in Linux?
CUPS was not originally installed on my server, I have installed it but cannot print to my network printer. On my laptop, I can... they are both running the same version of Debian. What could be missing?
Here are some details...
I have two computers running the same version of Debian. One is a server with no GUI and the other is my laptop with GDM installed. My laptop (which prints with no problem) is connected via Wifi. My server is connected directly to the router via Ethernet. I cannot print from the server.
The printer is a Canon Pixma MP495 that connects to the router via Wifi. I have downloaded drivers for the printer from [url] and installed them successfully using dpkg on both computers.
Right now I have a regular text file that I am using for a test page. To print from my laptop (with success) I type:
Code:
This does not work from the server. What could I be missing?
lpq run on server:
Code:
lpinfo readout:
Code:
I'm working on Linux OS (Suse/redhat) and trying to format a linux partition from a c program. Is there a way to do this without using : 'system ("mkfs.ext4 /dev/sdxy")'
View 4 Replies View RelatedWhen I print a form in PDF format the top 5 or so inches of the page is missing, when I view the page in Print preview the top of the page is not showing either. I need to print and send away this form asap. I just seen the bottom 5 inches of the page is missing as well
View 1 Replies View RelatedI just recently learned about the wonderful little lpr command- and using man -t (bash command) to beautifully print man pages for reference- but is there a way to print both sides of the paper using a printer so equipped?
View 2 Replies View RelatedI have just installed a Canon Pixma iP2200 on Fedora 14. The installation 'seemed' to go OK but whenever I try to print anything I get the following error:
"There was an error during the CUPS operation: 'client-error-document-format-not-supported'."
I have done a bit of searching and the only advice i could find is to uncomment some lines in /etc/cups/mime.convs and /etc/cups/mime.types but I don't have either of those files!
I have a debian system installed on my pc . I have just saved a text file on my desktop . Please let me know how can i print the file through comand prompt ? I need to learn the printing the file thru comamnd line .
View 1 Replies View RelatedIs there a free linux command line tool to convert SVG to PDF and/or some commonly-used bitmap format (for example PNG)?
View 2 Replies View RelatedI was copying a file to my pendrive it was taking a very log time which was ridiculous so I cancelled it but when I reboot my sysem next time my root drive became almost full (20gb partition, 12gb was free before. now its only 3 gb is free) also my pendrive is dead in linux in window it says you have to format the pendrive before use it when I click on format, format stops and says you don't have permission. also Now I cannot write anything on my winodws c or d drive because of permission.
View 4 Replies View RelatedI would like to find out what sources created this /proc/stat?
View 2 Replies View RelatedWhen a application is ran from the shell:fork() is calledexecve() is calledI know the shell stats the file to make sure the required permissions are allowed in the child shell. But I can not find this in the man fork. Nor can I find this in man execve. Which one of these processes/calls stats the binary to be ran?
View 1 Replies View Relatedim trying to collect some data. Is there a way to get the free memory stats over the past few days from some file... i looked into the sar log files but they dont have date stamps in them!
View 6 Replies View Relatedcan you see below command i give return me error however it has been working fine before. there is 1 directory i want to make it .tar.gz [root@sa1 script]# tar cvzf /var/opt/bkup_axigen/axigen_bkup_2.tar.gz /var/opt/axigen/domain tar: Removing leading `/' from member names tar: /var/opt/axigen/domain: Cannot stat: No such file or directory tar: Error exit delayed from previous errors
View 2 Replies View Related