New answers tagged

0

I understand that you're not happy with just PATH="./mybin:../mybin:../../mybin:../../../mybin:$PATH" until some limit like 8 or so sub-directories. Instead of polluting and breaking your regular command lookup, I suggest you use a short wrapper, such that the recursive lookup will only be done for the commands prefixed by it. Eg. k foo will try ./mybin/...


2

POSIX defines a pathname component as a filename. The phrase “pathname component” makes sense in the context of a path, e.g. mediawiki-1.33.0/.phan/config.php, where the components are mediawiki-1.33.0, .phan, and config.php. I had originally answered this here, so this is probably a duplicate.


2

Take the example path /path/to/file/. The three components of this path are path, to and file, separated by the delimiting character /. It really is as easy as that.


0

I’m not sure what I can say by way of explanation that hasn’t been covered by the other answers.  Instead, I’ll try to help you with examples. Arkadiusz Drabczyk gives the example from the GNU tar manual where your archive includes a large directory tree (e.g., all of /usr): $ tar -cf usr.tar /usr and you want to drill down into the archive and extract a ...


3

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 │   │ ...


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 ...


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 ...


0

Thanks to @mosvy, as per the user's comment, I entered the locations /usr/sbin and /sbin into my ~/.profile file. Login shells sources ~/.profile and therefore, now the missing locations are shown while echo $PATH.


-1

Problem solved. I was added a wrong PATH definition in /etc/environment. correcting that mistake solved the problem.


1

You can use the following below command to check whether the user has access to scp command or not: echo $PATH Example output: /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin This will display commands paths in which user have access. Suppose if you are checking for scp command, scp command will be located in /usr/bin/. If the output of ...


0

There is an error in your .bashrc file. Use the following command to restore the default version and then reconnect. $ cp /etc/skel/.bashrc ~/


0

It looks like your R package needs libpng16.so.16 (1.6. branch) whereas the default on CentOS 7 is the one you installed (1.5 branch, available via libpng package). If you don't mind using a commercial repository, libpng 1.6 is available at GetPageSpeed repo: sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm sudo yum install libpng16 ...


0

Tested and Worked fine #!/bin/bash echo "enter the input" read p cd $p echo "enter the file" read f if [[ -f $p/$f ]] then echo "file exsists" grep -io "$f" $p/$f >/dev/null if [[ $? == 0 ]] then r=`echo $f | sed "s/\.txt//g"` echo $r awk -v f="$f" -v r="$r" '{gsub(f,r,$0);print }' $f fi fi


1

It is the partition, volume group, or logical volume that contains the space, not the path. You can run du -sh or df -h but the first will just show you the space that the path itself is using and the second is a bit misleading because it will show what's available for the entire partition or volume group which contains the path. If that suits your needs, ...


0

Tried with code and worked fine It shows Total space,Avaialble space,Used Space df -Ph /boot/|awk 'NR >1 {gsub("%","",$0);print $0}'| awk '{print "Total Space of partition" " "$2"\n""Used space on the disk is" $3"\n""free space on the disk is "$4}'


0

I'm afraid you can't do what you specify with find and exec alone. Try piping find's result into a small while loop: find . -type f -name \*.html | while read PN; do sed "s|${PN##*/}|${PN%.*}|g" "$PN"; done


0

Since it is not a trivial task, I guess you will need a shell after -exec. Have a look at this: #!/bin/sh find . -type f -name "*.html" -exec sh -c ' for file in "$@"; do filename=$(basename "$file") noext=${file%.*} noext=${noext#./} sed -i.bak "s|$filename|$noext|g" "$file" done ' findshell {} + To generate the replacement string, it ...


2

Thanks to @Fox. Had to use sudo launchctl start|stop postfix


1

For any command or application Linux namespace can be used easily with firejail like the following example firejail --noprofile --quiet --blacklist=/path/to/exclude command-or-app Alternative way to exclude directory from find firejail --noprofile --quiet --blacklist=/path/to/exclude find /search/location -name am-looking-for-this Note that this method ...


Top 50 recent answers are included