By default, patch
ignores the directory portion of the target filename; it’s just looking for “httpd.conf” in your current working directory. If you want it to use the full path, you have to explicitly ask it to do so with the -p
option:
patch -p 0 < httpd.patch
The number after -p
is how many levels to remove from the filename path; -p N
strips off everything up to and including slash number N. The first slash is number 1, so -p 0
means “don’t strip anything”.
In general, you might be better off not relying on having the full path in the patch file, though; the patch will be more generally useful if it works even for files in a different directory layout. You can always cd into the directory containing the file before running patch (and use a full path to find the patch file itself, if needed, instead).
Related Posts:
- Given two directory trees, how can I find out which files differ by content?
- How do I deal with a filename that starts with the hyphen (-) character?
- What’s a .sh file?
- How can I symlink a file in Linux? [closed]
- Kill detached screen session [closed]
- How to get the url of the current svn repo?
- What does pss mean in /proc/pid/smaps
- apt-get error: Sub-process /usr/bin/dpkg returned an error code (1)
- performing HTTP requests with cURL (using PROXY)
- How do I grep recursively?
- How to perform grep operation on all files in a directory?
- Amazon Linux: apt-get: command not found
- How to extract C source code from .so file?
- Pass a password to ssh in pure bash
- How to substitute shell variables in complex text files
- “sed” command in bash
- gcc: error: unrecognized command line option
- How to exclude a directory in find . command
- How can I find all *.js file in directory recursively in Linux?
- How to set proxy for wget?
- Argument list too long error for rm, cp, mv commands
- How to change permissions for a folder and its subfolders/files in one step
- Difference between using “chmod a+x” and “chmod 755”
- Docker can’t connect to docker daemon
- Need a good hex editor for Linux
- Python subprocess.Popen “OSError: [Errno 12] Cannot allocate memory”
- How to open some ports on Ubuntu?
- Uncompress tar.gz file
- What does it mean to mount a file system in linux?
- curl: (6) Could not resolve host: google.com; Name or service not known
- How to pass password to scp?
- scp gives “not a regular file”
- -bash: fork: Cannot allocate memory
- Explanation of polkitd Unregistered Authentication Agent
- scp from Linux to Windows
- Bash script: bad interpreter
- How do I find the MySQL my.cnf location
- PHP and mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
- How to grep and replace
- node.js: cannot find module ‘request’
- What is the reason and how to avoid the [FIN, ACK] , [RST] and [RST, ACK]
- What does “&” at the end of a linux command mean?
- wget returns “Unable to establish SSL connection”
- How to recursively download a folder via FTP on Linux
- error : storage class specified for parameter
- httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
- How do I write stderr to a file while using “tee” with a pipe?
- How to include file in a bash shell script
- Does Mac OS X use Linux?
- bash sh – command not found
- Hosting multiple WordPress sites on single server – best practices?
- WordPress Update – This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php
- Can scp copy directories recursively?
- What are the functional differences between .profile .bash_profile and .bashrc
- Why does my hostname appear with the address 127.0.1.1 rather than 127.0.0.1 in /etc/hosts?
- Linux command to inspect TXT records of a domain [closed]
- df in linux not showing correct free space after file removal
- Setting the hostname: FQDN or short name?
- When does /tmp get cleared?
- What does a + mean at the end of the permissions from ls -l?
- How do I sleep for a millisecond in bash or ksh
- What does ‘set -e’ do, and why might it be considered dangerous?
- What version of RHEL am I using?
- What useful things can one add to one’s .bashrc? [closed]
- How do you make it obvious you are on a production system?
- How to add a timestamp to bash script log?
- How can I verify if TLS 1.2 is supported on a remote web server from the RHEL/CentOS shell?
- How to remove empty/blank lines from a file in Unix (including spaces)?
- Mount CIFS Host is down
- List of files installed from apt package
- How can I kill all stopped jobs?
- How to copy a large number of files quickly between two servers
- How to copy file preserving directory path in Linux?
- Postfix – how to retry delivery of mail in queue?
- Allow SFTP but disallow SSH?
- Is it possible to alias a hostname in Linux?
- How do I list loaded Linux module parameter values?
- Does getting disconnected from an SSH session kill your programs?
- Tips for Securing a LAMP Server
- What Linux distribution is the Amazon Linux AMI based on?
- What is this IP address: 169.254.169.254?
- How can I export the privileges from MySQL and then import to a new server?
- Is there a directory equivalent of /dev/null in Linux?
- Can I send some text to the STDIN of an active process running in a screen session?
- How can I get processor/RAM/disk specs from the Linux command Line? [duplicate]
- Should I install Linux applications in /var or /opt?
- Is there a way to see the execution tree of systemd?
- How to determine the hostname from an IP address in a Windows network?
- Heartbleed: how to reliably and portably check the OpenSSL version?
- create home directories after create users
- How can I fully log all bash scripts actions?
- How do I redirect subdomains to a different port on the same server?
- Running Cron every 2 hours [duplicate]
- How to check the physical status of an ethernet port in Linux?
- What does “debconf: delaying package configuration, since apt-utils is not installed” mean?
- Testing UDP port connectivity
- In Linux, what is the difference between “buffers” and “cache” reported by the free command?
- memcache vs memcached?
- zcat/gzcat works in linux, not on osx. general linux/osx compatibility
- What is the debian-sys-maint MySQL user (and more)?