New answers tagged

-2

I had same Issue. What helped was the Almighty sudo command. prepend that to your mv command and try again. That should work sudo mv <old_name> <new_path> Hope it works


0

This is from the sdkman discussion forum, sdkman/user-issues on Glitter: sdkman is currently only a user space tool and is designed as such. I recommend that you don't try sharing the folder for obvious reasons. Do you really want to have multiple users modifying a shared sdkman folder state? It smells bad to me.


0

The expansion of ~ to your home directory is linked to user management. But tilde expansion can do more. If you would have a user named projects, the tilde ~projects would expand to that user's home directory, probably /home/projects/. Conclusion: don't ever say I recommended this, but if you do not mind abusing your system a bit, you could add a user named ...


0

To do this reliably for any/all commands you would need to modify the standard system library that handles file I/O routines. Not impossible but more complex than I wish to describe here. The $CDPATH variable, as described in another answer here, will work perfectly for cd but will not work as a generalised solution. You could use a variable name, project=/...


1

You could create a wrapper function around cd that does a special sauce action. cd(){ case "$1" in (projects|projects/*) local dir="$1" command cd "/some/dir/${dir}" ;; (*) command cd "$@" ;; esac } With a little generalisation, this can be expanded to handle multiple special paths, and ...


2

If you're using dash, bash or ksh (and maybe some other shells - I don't remember all of them that have implemented this), you can set the CDPATH variable. From man bash: CDPATH The search path for the cd command. This is a colon-separated list of directories in which the shell looks for destination directories specified by the cd command. A sample value ...


0

The tilde operator is a bit more complicated than just the home directory. See: https://datacadamia.com/lang/bash/tilde_expansion Now, to create a variable or function that is present for all users (like PATH) add it to your system with a bash script in /etc/profile.d For example you could have a file /etc/profile.d/00-custom-vars.sh export PROJECT="/...


0

Here's what I would start with, using "scratch" as the source and "zork" as the new copy (which could be on a different dist). Note that I'm using the -a flag to cp so that file timestamps are preserved during copy. % (cd scratch ; tar cf - .) | shasum -a 256 a17cacd171d6cbc2f6da028c8167b0602a1146a337f602de71529999fe471e0f - % /bin/cp -...


0

K.I.S.S = Keep It Simple Student The easiest way without complication (if you are executing a predefined script) is just to temporarily set the HOME environment variable after sudo -i. But don't forget to change it back when done. There's probably a way in Linux to call a script when you exit sudo, but I'm not sure what that is. You will need to chown ...


1

The snippet below will ask for confirmation once, then it will delete the entire directory 'path/to/delete' Use read -p 'question ' answer to display the 'question ' to the user and store the answer in the variable ${answer}. (The trailing space in 'question ' makes the prompt more readable) Use the test clause [ ] with the string equality = operator to ...


0

If you visit your empty repository on GitHub using a web browser, you’ll see instructions explaining how to populate it (see this empty repository for example): Prepare a directory containing everything you want to upload, if you haven’t already done so. Initialise a git repository inside it: git init Add all the files and directories, and commit this: ...


3

In zsh, to tar all hidden dirs (and their contents): tar zcf file.tar.gz .*(/) (note that the standard .*/ is not the same as zsh's .*(/) as it would also include symlinks and with some tar implementations, because a / is appended to the paths resulting from the glob expansion, would tar them as directories (along with all their contents), not symlinks, so ...


4

It is often discouraged to use ls in shellscripts or complicated command lines because the results may be difficult to predict. The following commands using find should work, when your current directory is your home directory, ~, cd ~ This command will only get the hidden files LC_ALL=C find -mindepth 1 -maxdepth 1 -type f -name '.*' -print0 | tar --null -...


Top 50 recent answers are included