Tag Info

Hot answers tagged

33

The permissions 004 (------r--) means that the file can only be read by processes that are not running as the same user or as the same group as the FTP server. This is rather unusual: usually the user has more rights than the group, and the group has more rights than others. Normally the user can change the permissions, so it's pointless to give more ...


10

And surely any attacker who could alter the file for malicious purposes could likewise alter the given checksum. Not always. You could have a content link along with a checksum served on HTTPS. The link could be a nonencrypted link -- plain HTTP or FTP, or something else. On the downside, the unencrypted connection can get easily middle-manned, on the ...


10

With zsh or bash4, you can use brace expansion for that: ls -d GLDAS_NOAH025SUBP_3H.A2003{001..006}.{0000,0600,1200,1800}.001.2015210044609.pss.grb >/dev/null Notice the brackets: {001..006} means expand to 001, 002, ... 006 {0000,0600,1200,1800} to every one of the above add 0000, 0600, 1200 and 1800. >/dev/null is to avoid the standard output of ...


9

Why can you continue viewing a movie although it's been deleted? Because the file descriptor might be gone, but the inode is still there! And only when the inode gets deleted, is the file gone forever! So in your case: when you cd to / and all files in that tree are closed will the inodes be recycled and will the directory be gone forever¹... ...


8

The octal permissions mask of 004 corresponds to a symbolic permissions mask of u=,g=,o=r which means that the (u)ser who owns the file cannot read it or write to it or execute it, and neither can other users in the same (g)roup as the user who owns the file. Only (o)ther users who are neither the owner, nor in the same group as the owner, are able to read ...


8

To detect corruption is not entirely correct. To ascertain the integrity of the software would be a more correct usage. Normally a software is not distributed from a single server. The same software may be distributed from many servers. So when you download a particular software, the server closest to your destination is chosen as the download source to ...


8

There are two Linux commands called rename that are commonly available in distributions. I prefer the perl-based rename, as it's more powerful. You can check which one you have using $ prename --version. If you have the perl-based rename, $ rename --version perl-rename 1.9 $ rename 's/\(12345678\)/abcdefghij/' *.txt If you want to check it first with a ...


8

sed 's/=\(+[0-9]\{1,3\}\)/(\1)=\1/' To address your problem (as I understood): Patterns that need to be memorized in sed are to be enclosed in parentheses - their appearance defines their index number. E.g.: sed 's/\(<memorized_pattern_1>\)<not_memorized>\(<memorized_pattern_2>\)/\2\1/' would swap patterns 1 and 2 and delete the ...


7

How about: sort -nt'(' -k2 file.txt Test : $ sort -nt'(' -k2 file.txt fn=(916) __universe_MOD_general_main fn=(1368) __universe_MOD_general_boot cfn=(1370) __lib_file_MOD_file_open fn=(6142) __grid_var_MOD_get_overlap -n indicates we are sorting numerically t'(' sets the delimiter as ( -k2 sets the key to sort as the second field i.e. starting from ...


6

Yes, but the file is owned by the user. So the client itself has the 0 permission (user) on the file and cannot read it. You can test this yourself: echo TEST > myTestFile; chmod 004 myTestFile; cat myTestFile; chmod 700 myTestFile; cat myTestFile; The third step will raise an error.


6

# rm -rf /path/to/undeletable rm: cannot remove ‘/path/to/undeletable’: Is a directory rm calls stat(2) to check whether /path/to/undeletable is a directory (to be deleted by rmdir(2)) or a file (to be deleted by unlink(2). Since the stat call fails (we'll see why in a minute), rm decides to use unlink, which explains the error message. # rmdir ...


5

Try this. Sets the delimiter to =, and then uses field 2 from character 2 onwards (ignoring the "("). sort -t= -k 2.2n file.txt fn=(916) __universe_MOD_general_main fn=(1368) __universe_MOD_general_boot cfn=(1370) __lib_file_MOD_file_open fn=(6142) __grid_var_MOD_get_overlap Or even sort -t\( -k 2n <foo fn=(916) __universe_MOD_general_main fn=(1368) ...


5

Here is a method using bash's extglob: shopt -s extglob for f in .!(|.); do echo "$f" done With extglob the pattern !(pattern-list) matches anything except for the given pattern. The pattern in the example says match everything that starts with . and is not followed by nothing or another single ..


5

A variation on @chaos solution (bash 4.0 or above or zsh 4.3.11 and above): for a in GL.....2003{001..365}.{00..18..6}00.001.2015210044609.pss.grb do [[ -f $a ]] || echo "$a" done or for a in {001..365}.{00..18..6} do [[ -f "GL.....2003${a}00.001.2015210044609.pss.grb" ]] || echo "$a" done to print only the missing day+hour


5

I think pwd you run was a bash shell built-in. It just printed out the path it held in memory without looking up the file system. $ type pwd pwd is a shell builtin $ /bin/pwd /bin/pwd: couldn't find directory entry in '..' with matching i-node


4

For files which are not device that is not the minor number but the size in bytes. The size of a directory depends on which filesystem is used, and how many entries (i.e. files or subdirectories) are in it.


4

As far as why the TCP/IP error checking doesn't catch everything: From http://stackoverflow.com/a/17083365/2551539 There are different errors that can occur (that TCP will detect) [pointed out by Jacob Krall]: Incorrect order of the packets Loss of packets Corrupt data inside the packet Phantom packets (receiver gets packets that have never been sent) ...


4

Transmission errors can happen. Link-layer protocols typically contain checksums or error-correcting codes to avoid them, but they aren't perfect: there's a small chance that an error will go uncorrected. TCP packets also contain a checksum, which reduces the probability of errors by 2^16. That makes a very small, but nonzero probability of a transmission ...


4

Without / it might also be a file. In some situations it can be deadly. For example when using mv: mv file1 mydirectory mv file2 mydirectory mv file3 mydirectory All right? But if mydirectory did not exist or wasn't a directory, the final result is that file1 and file2 are gone and file3 is now named mydirectory. mv file1 mydirectory/ mv file2 ...


4

You are right in assuming that lsof uses the inode from the kernel's name cache. Under Linux platforms, the path name is provided by the Linux /proc file system. The handling of hard links is better explained in the FAQ: 3.3.4 Why doesn't lsof report the "correct" hard linked file path name? When lsof reports a rightmost path name component ...


4

Your file is not corrupted; On Linux and POSIX systems, as long as a running process has an opened file descriptor to some file that it is writing, it will be able to continue writing it, even if you remove or rename that file (because a file descriptor is related to an i-node, not to a file name). in particular logrotate or logadm -or any sequence of ...


4

# ls -lLh MyLog_nohup.out -rw-r-lr-- 1 user group 72G Jul 30 07:26 MyLog_nohup.out # du -sh MyLog_nohup.out 480K MyLog_nohup.out This looks like a sparse file to me. A sparse file allocates a virtual size on the disk (72G in your case) for efficiency but in reality the used space is as much data that is written on the file (480K in your ...


3

find <path>/. -type f -size 1033c ! -perm -0001 -ls


3

Try this. If happy with the proposed moves, remove the echo and rerun. $ ls download(12345678).txt img(12345678).txt upload(12345678).txt $ for F in *; do echo mv "$F" "${F/(12345678)/abcdefghij}"; done mv download(12345678).txt downloadabcdefghij.txt mv img(12345678).txt imgabcdefghij.txt mv upload(12345678).txt uploadabcdefghij.txt $


3

Use that: sed 's/=\(+[0-9]\+\)/(\1)=\1/' file It searches for =+ followed by at least one digit ([0-9]\+) and replaces all with the desired format ((\1)=\1).


3

sed 's/=\([^= ]*\) *$/(\1)&/' <in >out The above will just replace the last equals sign on a line and all characters which follow first with... A copy of those that follow and which are not space surrounded by two parens (in case there are any trailing spaces on a line) The whole matched pattern all over again. On the right-hand-side (the ...


3

...per your comment on the question... pax -rws'/\.JPG$/.CAP&/' /root/of/copied/tree /dest/path If .jpg and .JPG are your only issues, that should just work. You can also add a print primitive to the filename substitution to get a list of all of those filenames which were changed: pax -rws'/\.JPG$/.CAP&/p' /root/of/copied/tree /dest/path As ...


3

Assuming you have sufficient permissions to delete the file, simply deleting with the rm command should be sufficient: rm <filename> Note that the size of the file is irrelevant. When you delete a file, it typically isn't wiped in its entirety - instead the inode that points to the disk space is simply marked as unused. The disk space is then ...


3

While chaos's answer is good to be used in interactive shells, this one can be used as a POSIX script, for example if you need to do this periodically and/or do it on another computers. #!/bin/sh i=0 while test "$((i+=1))" -lt 366 ; do for j in 00 06 12 18 ; do file="GLDAS_NOAH025SUBP_3H.A2003$(printf '%03d' ...


2

Those are not minor numbers (as they are for the device nodes). This answer explains each field in turn.



Only top voted, non community-wiki answers of a minimum length are eligible