4

If the only issue is that the directories are hidden, you can just remove the . from the beginning of their name to make them unhidden. For example, using perl-rename (called rename on Ubuntu): rename 's/^\.//' '.\_Validate'* Or, with just shell tools: for dir in '.\_Validate'*; do echo mv "$dir" "${dir//.}"; done Bot of these leave you with horrible ...


4

The fragment of manpage you included in your question comes from man for GNU tar. GNU is a software project that prefers info manuals over manpages. In fact, tar manpage has been added to the GNU tar source code tree only in 2014 and it still is just a reference, not a full-blown manual with examples. You can invoke a full info manual with info tar, it's ...


4

If you know the name of the package, e.g. xbindkeys, you can list its contents in various ways: dpkg -L xbindkeys if it’s installed; dpkg-deb -c xbindkeys_1.8.6-1+b1_amd64.deb if you have the package file (without necessarily installing it); apt-file list xbindkeys whether or not it’s installed (if the indexes are up-to-date); on the packages.debian.org ...


3

I would use find for this: find . \( -name .git -o -name node_modules -o -name wp-snapshots \) -prune -o -type f -print | wc -l This looks for all files (including directories) starting from the current directory, and processes them as follows: if the name matches .git, node_modules, or wp-snapshots, the tree starting from the matching entry is ignored ...


3

From your the structure in the expected result, you just want to keep the files that don't end in .json. This will do it: cd Photos find . -type f ! -name *.json -exec mv {} . \; && rm -rf 2015* From inside of the Photos directory, you find the files that don't end in .json, move them into . or the current directory, and then delete the ...


3

You can use GNU Parallel: parallel mv {} '{=s/^\.\\_//=}' ::: '.\_ValidateAll'* This will remove .\_ from the names. To also replace spaces with _ run: parallel mv {} '{=s/^\.\\_//; s/\s/_/g=}' ::: '.\_ValidateAll'*


3

In principle (and as you probably know), files and directories are hidden if their name starts with a .. Thus, you can make them "visible" again by removing that .. It can be done in bash using, the builtin string manipulation functions: user@host$ for dir in '.\_ValidateAll'*; do newname="${dir#.}"; mv "$dir" "$newname"; done You would be well-advised, ...


3

The issue was that the directory appeared to have non-visible characters at the end of its name. Using a shell globbing pattern, Gullane*, the user was able to enter the directory, and then also to rename the directory with a more usable name: mv Gullane* Gullane The * part of the globbing pattern would match the blank/non-visible characters at the end of ...


2

Yes you can brute force such a directory. Unix was originally created in a very co-operative environment, so a set of permissions that said don't browse here would have been respected. If the users of your machine don't have that sort of culture then (assuming you can't change your users) don't create directories with execute permissions if you want to ...


2

A *nix system makes no difference between a file and a directory, whereby a directory is just a file containing names of other files (and numbers of inodes). Therefore, as the content of a directory grows with the amount of files it contains, the size (blocks) used to store this content will grow as well. To my knowledge. it will not shrink when files are ...


2

With zsh: print -rC1 -- *(N/oe['REPLY=${REPLY#?}']) print -rC1 prints its arguments raw on 1 Column *(qualifiers): glob with glob qualifiers N: Nullglob: expands to nothing if there's no match /: only select files of type directory oe[expression]: order the list based on the result of the expression (of the value of $REPLY initially containing the file ...


2

With sort, you can use a key of the form F.C to specify a character position within a field. So for example $ printf '%s\n' */ | sort -k1.2 yalberto/ mreynolds/ lrodriguez/ Note that this will fail if any of the directory names contains a newline. That could be worked around with GNU sort by working with NUL-delimited records instead with: printf '%s\0' ...


2

info mv has this: _Note_: 'mv' will only replace empty directories in the destination. Conflicting populated directories are skipped with a diagnostic. There is no option to overrule that, so it seems. Either remove B and rename A (back to B), or empty/delete the directories in B by hand first.


2

I don’t think there is a GUI equivalent to this option. The --strip-components option to tar is effectively a cut on the file paths. Going back to the tarball that started all this, tar tf shows mediawiki-1.33.0/.phan/config.php mediawiki-1.33.0/.phan/internal_stubs/memcached.phan_php mediawiki-1.33.0/.phan/internal_stubs/oci8.phan_php mediawiki-1.33.0/....


2

I understand that the rightmost file of a file tree of at least two directories, will be extracted... No, the first two directory components dir1/dir2 of the tree are omitted from extraction (if you're extracting relative pathnames). This is different. Lets assume we have the following directory structure: dir1 ├── dir2 │   ├── dir3 │   │   ├── dir4 │   │ ...


1

The solution is to use parameter substitution, twice. We start by storing the pathname of the directory in a variable (if you're dealing with the current working directory, you can skip this and use PWD in place of p later): $ p=/a/b/c/d/e/c/f/g We may then remove the longest prefix string that matches */c/ from this: $ echo "${p##*/c/}" f/g We then ...


1

I recommend using rsync With rsync, you can specify that you would like the files to be deleted and you can even do a "dry run" to see exactly what would happen if you were to run it for real. Try rsync -av --dry-run --delete-before fromA toB The --delete-before is great for merging files on systems that are low on space. If you are happy with the dry ...


1

The syntax of tar is tar -f output input So you want to run tar -cvjf /path/to/output.tar.bz2 /what/you/want/to/compress


1

The permissions of a new file are set from (1) the permissions set in the open() call modified by (2) the umask of the creating process, so that bits set in the umask are zeroed. That is, a permission bit is set only if allowed by both of those, it's just that the bits in umask are inverted. In your case the users probably have different umasks, namely A ...


1

If they can do that, is there really a point in e.g setting 711 permissions on a home folder to protect its content while allowing access to things like SSH keys? (I've read people advise this.) Then either (a) they were misguided, or (b) you have probably comprehended only part of the advice. OpenSSH (at least) requires that SSH keys have restricted ...


1

To supplement the good answer by larsks, to try to help clear up the confusion around the -C option: The tar man page states for the -C option: -C, --directory=DIR Change to DIR before performing any operations. This option is order-sensitive, i.e. it affects all options that follow. so, it is not like mv - it is literally ...


1

mkdir -p parent/child && touch "$_/file.txt" $_ is a shell parameter, it expands to last argument of previous command. Example mkdir test && cd "$_" will create and cd into the directory test.


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