date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,652,101,680,000 |
I've this script that creates a mysql dump of a database and sends it to a storage server. But I see that, sometimes, the generated files is of wrong size, even sending the file with rsync.
I'd like to test the remote file for md5sum and if hash is the same, the local file is removed. If the hash is different, though,... |
rsync knows when a file is incomplete.
Just run rsync regularly, and it will by itself take care to re-send new parts of the file as needed.
It could happen that $TEMPDIR is too small to contain the tar czvf ? then you would send that (incomplete) file with rsync?
why not simplify:
dump the DB as you did
then cd "$L... | how to make a loop with md5sum test on a bash script? |
1,652,101,680,000 |
For the encrypted base64 encoded SHAX strings, what command can decrypt it back to original string, thanks
|
From the linked post, your original string was generated by a method such as
echo -n foo | openssl dgst -binary -sha1 | openssl base64
What this generates is a digest, with SHA1 being the method of calculating the digest.
In this situation there is insufficient data to reconstruct the original string. This digest is... | How can I decrypt back a base64 encoded shaX binary string? |
1,652,101,680,000 |
I know that dpkg keeps md5sums of configuration files for each package installed, so it can tell whether they are changed or not when upgrading.
Does it keep md5sums for regular (non-configuration) files as well?
|
Yes, look at the contents of /var/lib/dpkg/info/*.md5sums. Strictly speaking this isn't handled by dpkg; these checksums are generated at build-time (typically by dh_md5sums) and included in the binary packages.
You can check that the installed files still match their MD5 checksums using the debsums command.
| Debian package's files authentication |
1,652,101,680,000 |
Consider a folder with many XML files (10K small text files). Some XML files are identical, some are different.
I would like to find out what files are identical (ignoring whitespaces, tabs and linebreaks) and record the files in each cluster somehow.
I don't need high precision on this, so I thought one way of doing... |
You could create a "normalized" version of each XML file with something like:
xmllint --nospace --format orginal.xml > normalized.xml
That would get rid of "unimportant"-to-XML whitespace, indent consistently and so forth. After that, you could use cksum to find identical normalized files.
I'll suggest a script:
for ... | Clustering identical files ignoring spaces & linebreaks |
1,652,101,680,000 |
Why the difference in the following?
$ echo -n "foo" | openssl dgst -sha1 -hmac "key"
(stdin)= 9fc254126c2b1b7f106abacae0cb77e73411fad7
$ echo -n "foo" | sha1sum
0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 -
|
The -hmac "key" is what does it. Adding a HMAC is sort of like salting the data. It's not quite the same but you're changing how the hash is calculated. Thus you end up with a different result.
| sha1sum reporting different hash value relative to openssl |
1,652,101,680,000 |
I'm using this right now:
time md5sum -c *.txt | pv | grep -v ': OK$'
but aren't there any smart solutions that can list that how many files haven't been checked? I mean I have many md5sum's in .txt files in a dir, and I need to check them, but it would be a good thing to know that how much files are left to scan..
p... |
You could pass the names to md5sum one by one.
n=$(cat *.txt | wc -l)
cat *.txt | {
i=0 bad=0
while IFS= read -r line; do
i=$((i+1))
echo "Checking file $i/$n: $line"
echo "$line" | md5sum -c - || bad=$((bad+1))
done
[ $bad -eq 0 ] || { echo "$bad bad checksums"; false; }
}
Or, for casual use, you... | Good "progress bar" about md5sum checking progress? |
1,652,101,680,000 |
Doing here some file listing with find command as follows:
find /dir1/ -type f -exec md5sum {} + | sort -k 2 > dir1.txt
Then:
find /dir2/ -type f -exec md5sum {} + | sort -k 2 > dir2.txt
Noticed that were some equal hashes despite being different files, for example, an xxxxxxxx.jpg image file with same hash of an yyyy... |
The collision probability of md5sum is 1 in 264. Refer this post on crypto.se for more details.
SideNote: The contents of the file is hashed, filename doesn't play any role in hashing. Are you sure the files are differnent and not just the names?
$ md5 /tmp/files.txt*
MD5 (/tmp/files.txt) = 29fbedcb8a908b34ebfa7e4839... | Acuracy Level of md5sum Comparison |
1,652,101,680,000 |
I am uploading a file via sftp and just performing the safety test if the file is completely uploaded to the remote server. I am taking md5 hash of both(file in local and file in remote server) and matching them. If they match I conclude that the upload was successful. Here is the part of code from shell script.
ssh $... |
You are using single quotes surrounding the ssh command. This way the variables $TARGET_DIR and $filename are taken literally instead of being evaluated. Change the single quotes to double quotes to have the variables evaluated:
ssh $REMOTE_MC "digest -a md5 $TARGET_DIR/$filename" > $HOME_DIR/remote_hash_$datetag.txt
... | Executing a command in remote machine and redirecting output to a local file |
1,652,101,680,000 |
I have a file like this :
1 Record|1111|ABC
2 text in between for record 1
3 text in between for record 1
4 Record|2222|XYZ
5 text in between for record 2
6 Record|3333|XYZ
7 text in between for record 3
8 .
I want to read this file and generate something like
<Record_number> | <start line> | <n... |
Based on Costas' answer.
1) Create a file parse.awk, with the following content :
/^Record/ {
if (s>0) {
printf ("%s|%s|", r,l)
system("echo '"line"' | md5sum - | awk '{print $1}' ");
}
s=1;
r=$2;
c=1;
l=NR;
line="$0";
}
!/^Record/ {
line=line"\n""$0";
c+=1
}
END {
printf ("%s|%s|", r,l)
... | Read file and find all occurrences and generate hash for the content between the occurrences |
1,652,101,680,000 |
We are working with an older software product that has some limited programming capabilities - specifically, no bit manipulation functions. This has created a significant problem as we need to implement a HMAC-MD5 Hash to interface with an industry standard software interface.
The older software does have the ability ... |
The compiler should be gcc, If you don't have it, the package has the same name—install it however you normally install CentOS package (e.g., yum install gcc)
There are a lot of open source implementations of HMAC-MD5. Any crypto library will have it. And various other projects have one. Google or a code search will q... | C-library HMAC_MD5 questions |
1,652,101,680,000 |
I am creating an image of an sd-card partition (dd) and eventually the checksum (md5sum) of the image and the partition are not the same.
What am i doing wrong?
My sd card is inserted into an external reader but not mounted.
sudo fdisk -l
Device Boot Start End Sectors Size Id Type
/dev/sdc3 ... |
Your SD is dead or dying (see more below), you will need to replace it. I’ve included some advice on what to use instead:
Using a SD card for a Raspberry Pi will drastically reduce their life expectancy. There are designed for 15 years of camera use, but with a RPi you will be writing logs tens if not hundreds of time... | md5sum of image and sd-card partition differ |
1,652,101,680,000 |
I have written this shell script to test sha-516 hash password string :
myhash='$6$nxIRLUXhRQlj$t29nGt1moX3KcuFZmRwUjdiS9pcLWpqKhAY0Y0bp2pqs3fPrnVAXKKbLfyZcvkkcwcbr2Abc8sBZBXI9UaguU.' #Which is created by mkpasswd for test
i=0
while [[ 1 -eq 1 ]]
do
testpass=$(mkpasswd -m sha-512 "test")
i=$[ $i + 1 ]... |
A password hash (like what you put in myhash) contains some metadata indicating which hash function is used and with what parameters such as cost, a salt, and the output of the hash function. In the modern Unix password hash format, the parts are separated by $:
6 indicates the Unix iterated SHA-512 method (a design ... | How does my linux OS make so quickly sign in process? |
1,652,101,680,000 |
I want to create a hash of more than one source in Bash.
I am aware that I can:
echo -n "STRING" | sha256sum
or
sha256sum [FILE]
What I need is:
STRING + FILE
FILE + FILE
STRING + STRING
STRING + FILE + STRING
For example STRING + FILE
Save the hash of STRING in a variable and the hash of the [FILE] in a variable. ... |
You could create a script like this to hash multiple files, and then hash the concatenation of their hashes. Hashing in two parts like this instead of concatenating all data first should work to prevent mixups where the concatenation loses information on the borders between the inputs (e.g. ab+c != a+bc).
#!/bin/bash
... | How can I create a hash or sha256sum in Bash using multiple sources or inputs? What is the recommended method? |
1,421,872,935,000 |
I have found out, how I can convert plain text into an SHA (http://hash.online-convert.com/sha512-generator), but how can I convert a SHA key to plain text?
|
SHA-1, SHA-256, SHA-512 and all the other SHA functions are cryptographic hash functions. One of the defining properties of cryptographic hash functions is preimage resistance: given a cryptographic hash function F and a value h, it is infeasible to find a text m such that F(m) = h. Note that hashing is not encryption... | How to convert SHA to plain text? [closed] |
1,421,872,935,000 |
I am running a script that copy a file from one location to other. In script I am calculating MD5sum using below command of original file and copied file and they are different:
echo -n "file" | md5sum
How come a same file have different MD5sum? Does copy command change something in Linux?
I have also checked checksu... |
echo -n "file" | md5sum
You are not calculating the checksum of the file, but of the filename. It is probably different because you are using two different paths (echo -n "/old/path/to/file" | md5sum vs. echo -n "/new/path/to/file" | md5sum).
To calculate the md5sum of the file, use this command:
md5sum file
| different checksum of original file and copied file |
1,421,872,935,000 |
I use OS X and have several checksum files that are generated from different external harddisks.
If the checksum files are in the same location as the files to check then I can simply run eg.:
shasum -c sums.sha1
But in my case sums.sha1 is located in ~/Desktop/sums.sha1 and the files to verify are in /Volumes/fr-ubb... |
Run it from the directory containing the files to check, and give it the full path to the checksum file:
cd /Volumes/fr-ubb-1
shasum -c ~/Desktop/sums.sha1
This works with most (perhaps all) checksum verification tools, not just shasum.
| How to verify checksums if files to check are mounted on different location? |
1,421,872,935,000 |
What is the output of date -u +%W$(uname)|sha256sum|sed 's/\W//g' (on Arch Linux if it matters)?
How do I find that out?
|
date -u %W
Displays the current week of the year.
uname
Displays the kernel name.
sha256sum
Generates a SHA-256 Hash Sum.
sed 's/\W//g'
Cuts out all non-word characters.
The |'s are redirecting the output of the first command to the appending command.
Enter the line in a terminal, f.e. gnome-terminal or xterm:
dat... | Shell output question |
1,421,872,935,000 |
We want to find all the .jar files with their chksum.
find . -name "*.jar"
./lib/ant-1.8.0.jar
./lib/ant-launcher-1.8.0.jar
./lib/backport-util-concurrent-3.1.jar
./lib/classworlds-1.1-alpha-2.jar
./lib/commons-codec-1.6.jar
./lib/commons-io-2.2.jar
./lib/commons-logging-1.1.1.jar
./lib/jline-0.9.94.jar
expected out... |
You can use the exec action of find to do this:
find . -name "*.jar" -exec cksum {} \+
The exec action runs the cksum command on each result of find. The + operator specifies that multiple results from find are passed to a single execution of cksum.
Do note that the order of columns is slightly different from your qu... | find the relevant files with their checksum |
1,421,872,935,000 |
I am trying to setup postfix to relay all mail generated on the local machine via SMTP to a mailgun relay. I have used the mailgun relay before with success on an ubuntu server, but I am migrating to a Centos 7 server which I will be running in FIPS mode. There error log is below, slightly sanitized. I have a small... |
After many more hours of trying to figure it out, including turning up debug on the smtp and tlsmgr processes in master.cf, I was able to determine that the FIPS disabling md5 was indeed the issue. Adding the following to master.cf fixed the issue:
smtp_tls_fingerprint_digest=sha256
Setting to sha1 and sha512 also w... | Postfix configuration issue with fips on centos 7; mailgun relay |
1,421,872,935,000 |
I've been having some troubles with my newly installed Ubuntu system (random freezing) and I wanted to verify that the iso I received was not corrupted by checking the sha256 hashes (I know I should have done that first). I followed the instruction on the Ubuntu website but I keep getting the same warning, shown belo... |
The important line here is this one:
ubuntu-16.04.1-desktop-amd64.iso: OK
Your ISO is OK.
The checksum file contains sums for all the images; sha256sum warns you about the ones you haven't downloaded, because it can't verify them.
| ubuntu iso sha256 checksum |
1,421,872,935,000 |
When I try to verify the integrity of git-man-pages package I downloaded from "http://code.google.com/p/git-core/downloads/detail?name=git-manpages-1.8.4.tar.gz&can=2&q=" it fails with error.
Command which i ran: md5sum -c git-manpages-1.8.4.tar.gz
Error displayed:
md5sum: git-manpages-1.8.4.tar.gz: no properly forma... |
If you just want to compute the checksum of the file you downloaded you should leave the -c out. Apologies if I didn't understand your question right. For example:
$ md5sum git-manpages-1.8.4.tar.gz
e3720f56e18a5ab8ee1871ac9c72ca7c git-manpages-1.8.4.tar.gz
md5sum also expects 2 spaces between checksum and file nam... | md5sum check fails for git-man-pages.tar.gz package |
1,421,872,935,000 |
I'd like to be able to detect when a file is considered different if the data are still the same but the ownership has changed (or the permission, access/creation time, etc...).
Is there a such tool ?
|
As stated in the answer provided by Detect changes in permissions, you can determine the time of permission changes and the actual permissions by using the stat command.
So something like that should work:
stat -c "%a %Z" file | cat - file | sha1sum
| Generate file digest using data, file ownership & permission and others |
1,421,872,935,000 |
Is time complexity of Linux SHA1 linear? That means that 2GB file is hashed twice longer than 1GB file?
|
Yes. There's no sensible way to implement SHA-1, SHA2, SHA3 or any other cryptographic hash function in anything other than linear time. It's impossible to have sub-linear time since the output depends on every bit of the input, and a linear time implementation is straightforward so there's no reason for an implementa... | Linux SHA1 Time Complexity |
1,421,872,935,000 |
I tried with openssl as it is very fast:
openssl sha1 "$(basename "very_big_image.png")"
But this just substitutes the actual file for check summing.
|
If you mean the checksum of the string used as a file name, you need to pass the string to your preferred checksum tool:
$ printf 'very_big_image.png' | openssl sha1
(stdin)= a2f2cfa4c7042222ecd8d980e7b26e46ee0895e5
$ printf 'very_big_image.png' | md5sum
52846a1d6726e254756f47cfaf9e116a -
$ printf 'very_big_image.png... | How to calculate the checksum of a file's name? |
1,421,872,935,000 |
I observe that when I use PIGZ version, generated tar file's md5sum hash is different than the next one generated.
Instead of PIGZ=-n if I use GZIP=-n generated hashes are same. I have followed following answer for Tar produces different files each time.
$ find sourceCode -print0 | LC_ALL=C sort -z | PIGZ=-n tar \
--... |
If you want tar to use pigz, you need to ask it to do so:
... | PIGZ=-n tar -Ipigz --mode=a+rwX --owner=0 --group=0 --absolute-names --no-recursion --null -T - -cvf file.tar.gz
With the -Ipigz option, and without -z, tar uses pigz and the PIGZ variable is taken into account. This results in tarballs with the same co... | Why does the PIGZ produce a different md5sum |
1,421,872,935,000 |
The author wrote ssh public finngerprint in the webpage.
fingerprint
If you want to send me an email, my fingerprint is:
5029 E0D0 F458 72E4 09D3 308D 1D51 378E E348 35B6
Now i make a verification.
For public RSA (SSH) key:
wget https://www.bjornjohansen.com/pubkey.txt
ssh-keygen -l -E md5 -f pubkey.txt
2048 MD... |
Your understanding isn't correct. Checking the SSH public key is irrelevant. The email fingerprint is for the PGP Public key which would require you to use GnuPG (aka gpg) to validate the fingerprint.
wget https://www.bjornjohansen.com/E34835B6.asc
gpg --import E34835B6.asc
gpg --fingerprint 5029E0D0F45872E409D3308D1D... | Get different md5 value when to verify ssh public key |
1,421,872,935,000 |
I'm trying to store the MD5 of a variable into another variable. Between backticks and the more modern () notation, I cannot figure out how to assign the value of a variable run through a command to another variable. Sample code:
#!/bin/bash
backup_dir=$(date +%Y-%m-%d_%H-%M-%S)
hashed=$( ${backup_dir} | md5)
Here, ... |
You are expecting md5 to read the value of the backup_dir variable and return its MD5 hash sum.
The command pipeline
${backup_dir} | md5
would try to run $backup_dir as a command, piping its output to md5. I would expect a "command not found" error from this, along with the MD5 hash of the empty string (d41d8cd98f00... | In a bash script, how to use a variable inside a command and assign to a new variable? |
1,421,872,935,000 |
This recursive md5sum check for 40000 items of 11.8 GB takes 2 minutes:
ret=$(find "${target}"/ -name ".md5sum" -size +0 | while read aFile; do cd "${aFile%/*}"; md5sum -c ".md5sum"; done | grep -v "OK";)
Can any obvious speed improvements be made, that I have not noticed?
|
Not really.
Unless you decide to forgo the check altogether if size+timestamp matches, there is little to optimize if the checksums actually match; the files will all be identical but to verify that, you actually have to read all of it and that just takes time.
You could reduce the number of md5sum calls to a single o... | Improve execution time for recursive md5sum check? |
1,421,872,935,000 |
What is a good way to perform a SHA256d hash (double SHA256) on the default terminal of an network isolated OpenBSD fresh install?
Here's what I'm doing:
echo test > testfile
cat testfile | openssl dgst -binary | openssl dgst
It gives me a number ending in 0xe0b6
Just wondering if there is a more concise/otherwise be... |
openssl dgst -binary testfile | sha256
... is shorter, but there is no built-in way of applying the SHA256 hash twice on some input in any of the base utilities on OpenBSD.
| What is a good way to perform a SHA256d hash (double SHA256) on an OpenBSD fresh install? |
1,421,872,935,000 |
An external USB flash drive containing 2 partitions is connected to my Raspberry Pi.
I want to dd an image file to this external flash drive if the first partition on the flash drive is not the same as the first one of the image file.
To achieve that, I will compare their checksum.
It's easy to compute the checksum of... |
You can use losetup --partscan --find --show /path/to/disk.img to set up one or more loop devices (/dev/loopN) for the image and its partitions
Example
dd if=/dev/zero bs=1M count=100 >/tmp/100M.img
pimg() { parted /tmp/100M.img --align optimal unit MiB "$@"; }
pimg mklabel gpt
pimg mkpart primary 2 50
pimg mkpart p... | Compute checksum of a partition inside an image file |
1,421,872,935,000 |
Example I have these files
/sdcard/testfolder/file1
/sdcard/testfolder/file2
/sdcard/testfolder/file3
/sdcard/testfolder/file4.ext
I would like to create .sha256 files for each
/sdcard/testfolder/file1.sha256
/sdcard/testfolder/file2.sha256
/sdcard/testfolder/file3.sha256
/sdcard/testfolder/file4.ext.sha256
The meth... |
What I would do:
find /sdcard/testfolder -not -name '*sha256' -type file -exec sh -c '
sha256sum "$1" > "$1.sha256"
' sh {} \;
| How to recursively create .sha256 hash files for every file in a folder? |
1,421,872,935,000 |
On a centos 7 I'm trying to arhive and do a checksum over a directory but at the end the files are empty.
localpath=/backup
name=$(date '+%Y-%m-%d')
tar cvzf $localpath/BackUp$name.tgz $localpath/BackUp* | md5sum $localpath/BackUp$name.tgz > $localpath/checksum$name
Can you please advise on what I'm doing wrong ?
|
A pipe, |, is used for sending the output of the command on the left-hand side to the input of the command on the right-hand side. The commands on the left and right-hand side are started concurrently, and it is only the writing and reading from the left to the right that synchronises the two parts of the pipeline.
I... | tar archive and checksum empty |
1,421,872,935,000 |
I have 2 ~55 Gb folders (with many subfolders) that contain more than 1500 files per ~30 Mb.
I need to compare them and get information if some files are missing / new files persist or their hash is not identical to original content.
How I can do it?
|
You can try something like:
cd path1
find . -type f -exec sha1sum {} \; >/var/tmp/sum.path1
cd path2
sha1sum -c /var/tmp/sum.path1|grep -v "OK$"
(the grep remove lines with OK at the end to display only failed missing/different hash)
And you can change the hash algorithm to try to minimize the collision factor
| How to diff folders and get verbose information? |
1,421,872,935,000 |
there are multiple checksum commands in the GNU Core Utilities in most Linux distros for famous hashing algorithms like SHA2 or MD5, But I need a command for MD6 (message digest 6) checksum that can generate 128/256/512 bit size md6 hashes.
actually some programming languages has support for md6 in some of their libra... |
GUI: https://github.com/tristanheaven/gtkhash
Python: https://pypi.org/project/md6/#files
PHP/JS: https://github.com/Snack-X/md6 | https://github.com/Neo-Desktop/md6 | https://github.com/Richienb/md6-hash
Rust: https://docs.rs/md6/2.0.2/md6/
Perl: https://github.com/AndyA/Digest--MD6
Swift: https://github.com/ImKcat/... | MD6 hash generation linux command for 128-bit, 256-bit, 512-bit MD6 hashes |
1,421,872,935,000 |
According to the manual of argon2 (Debian package), it says to pass the password from standard input. However, when I follow the instructions and attempt
echo -n "password" | argon2 salt "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"-t 4 -e
the program simply returns Error: unknown argument.
What ... |
The first argument, the salt value, should be the actual salt that you want to use. Therefore, your command should probably look like
echo -n "password" |
argon2 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" -t 4 -e
if the string of a characters is your salt. Note also the space between the salt ... | Unable to pass argument to argon2 command |
1,421,872,935,000 |
I use this procedure
openssl req -newkey rsa:2048 -sha256 -subj "/C=IT/ST=Lazio/L=Roma/O=Blu/CN=server.server.server" -keyout ssl.key -out ssl.req -passout file:"/root/pass" ;done
#sign certificate
openssl ca -passin file:"/root/pass" -out key.crt -infiles ssl.req ;done
#removepass
for i in *key;do openssl rsa -in $i ... |
Solution found
on openssl.cnf
default_days = 1000 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = default # use public key default MD
preserve = no # keep passed DN ordering
become
default_days = 1000 # how long to certify... | Want a sha256 ssl cert,but i get sha1,why? |
1,421,872,935,000 |
I am trying to follow procedures at
How To Create Your Own Odin Flashable TAR or TAR.MD5
And the command md5sum -t your_odin_package.tar >> your_odin_package.tar does not work for me. That is, when I try to validate that I have a authenticated file, I get an error.
md5sum -t your_odin_package.tar >> your_odin_packag... |
By adding the md5sum to the file, the md5sum of the file content changes. More usual is to keep the md5sum in a separate file, or change the filename to include the md5sum:
mv abc.tar abc.tar.$(md5sum abc.tar | cut -d ' ' -f 1)
There are files that store a checksum in the file (somewhere in the header, or at the end... | How do I add the hash of a file to file itself |
1,421,872,935,000 |
I have two files on ftp location in csv.gz format and their checksum is in .csv.gz.md5 format. I am copying this file in my local system. I am generating check sum for it through md5sum. Now I am comparing it against the copied file.
Now I want to identify any error in a file if there is one and also which file is ha... |
If csv.gz.md5 was generated using md5sum csv.gz > csv.gz.md5, then you can check using md5sum -c cvs.gz.md5.
$ echo Hello World > something.abc
$ md5sum something.abc > something.abc.md5
$ md5sum -c something.abc.md5 && echo YAY || echo NAY
something.abc: OK
YAY
$ echo Garbage >> something.abc
$ md5sum -c something.ab... | How to identify error in a particular file while checksum verification (which file having problem while verification) in shell script |
1,421,872,935,000 |
Why do I become a different hash when I try:
md5 <<< "Hello"
md5 -s "Hello"
Is it because of a possible line break in the first example?
|
Heredocs (thats what <<< is called) in bash always end with a newline character. There is no way to disable this behavior. This newline character is what is throwing off the checksum.
| md5 String and File different |
1,421,872,935,000 |
I'm trying to synchronize literally thousands of files of various sizes and I would like to have a 1:1 copy of the files. That means that already present files should be checked for their integrity and if there's a wrong checksum, the file needs to be overwritten. A so-called delta transfer is only necessary at this p... |
You sound like you are copying between two local filesystems. If so then rsync will not use its checksum scheme and will fall back to being cp.
Both cp and rsync will preserve owner/group if they are run as root. Otherwise the destination files will take the owner and (default) group of the account performing the copy... | How do you synchronize files with partially failed download using rsync? |
1,421,872,935,000 |
I have a disk which is perhaps broken. I want to write random data to the disk and later verify the md5 checksum.
I write to the disk like this:
dd if=/dev/urandom of=/dev/sda bs=4M status=progress
How to create the md5 checksum while writing to the disk at the same time? I want to see the md5 checksum of the written... |
Rather than write your own solution you can use a standard scan utility.
badblocks -w -s /dev/sda
will scan the entire disk, writing patterns to each individual block then reading the block back and comparing the results. Progress is displayed during the scan. You can also specify a number of passes if the default si... | How to calculate the checksum while writing random data to a disk? |
1,421,872,935,000 |
in folder , we have the following HADOOP binary files and their size (BYTES)
du -sb * | grep HADOOP[a-z]
334542327 HADOOPaa
334542327 HADOOPab
334542327 HADOOPac
334542327 HADOOPad
334542327 HADOOPae
334542327 HADOOPaf
334542327 HADOOPag
334542327 HADOOPah
334542327 ... |
Not sure what you're going for here... but it sounds like you want awk (or cut) after the grep to only print the sums. But then a checksum of checksums to ensure you have all the files? Is that the end result you wanted?
BTW, I'm almost positive the glob md5sum * returns a random order, so you probably want a sort in ... | calculate the total md5 of specific match files |
1,421,872,935,000 |
I am in need of creating and checking checksums between a local file, and the remote file I just pushed. If the MD5 checks, continue, else break. This needs to be in KORN shell scripting because we are using AIX machines.
here's the code I have so far:
for file in <<Directory>>; do
-- Get MD5 of local file
L... |
Since you say: the remote file I just pushed, the probability of any file difference is extremely low over sftp (based on ssh code). As low as (in the order of) the probability that the md5 of two different files have the same hashsum.
And, the short answer is:
An sftp session doesn't allow remote execution of command... | Using korn shell to compare local and remote MD5 over sftp |
1,478,993,911,000 |
I am renting a server, running Ubuntu 16.04 at a company, let's name it company.org.
Currently, my server is configured like this:
hostname: server737263
domain name: company.org
Here's my FQDN:
user@server737263:~ $ hostname --fqdn
server737263.company.org
This is not surprising.
I am also renting a domain name, l... |
Setting your hostname:
You'll want to edit /etc/hostname with your new hostname.
Then, run sudo hostname $(cat /etc/hostname).
Setting your domain, assuming you have a resolvconf binary:
In /etc/resolvconf/resolv.conf.d/head, you'll add then line domain your.domain.name (not your FQDN, just the domain name).
The... | How to correctly set hostname and domain name? |
1,478,993,911,000 |
I can't seem to change the hostname on my CentOS 6.5 host.
I am following instructions I found on this (now defunct) page.
I set my /etc/hosts like so ...
[root@mig-dev-006 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.32.128 ost-dev-00.domain.example ost-dev-00
192.168.32.129... |
to change the hostname permanently, you need to change it in two places:
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=newHostName
and:
a good idea if you have any applications that need to resolve the IP of the hostname)
vi /etc/hosts
127.0.0.1 newHostName
127.0.0.1 localhost localhost.localdomain localhost4 ... | How to change hostname on CentOS 6.5? |
1,478,993,911,000 |
All the results of my searches end up having something to do with hostname or uname -n. I looked up the manual for both, looking for sneaky options, but no luck.
I am trying to find an equivalent of OSX's scutil --get ComputerName on Linux systems. On Mac OS X, the computer name is used as a human-readable identifier ... |
The closest equivalent to a human-readable (and human-chosen) name for any computer running Linux is the default hostname stored in /etc/hostname. On some (not all) Linux distributions, this name is entered during installation as the computee’s name (but with network hostname constraints, unlike macOS’s computer name)... | How to get the computer name (not its hostname)? |
1,478,993,911,000 |
I have a domain setup to point to my LAN's external IP using dynamic DNS, because my external IP address changes frequently. However, I want to create an alias to this host, so I can access it with home. So I appended the following to my /etc/hosts:
example.com home
However, it doesn’t seem to like the domain name. If... |
The file /etc/hosts contains IP addresses and host names only. You cannot alias the string "home" in the way that you want by this method.
If you were running your own DNS server you'd be able to add a CNAME record to make home.example.com an alias for domain.example, but otherwise you're out of luck.
The best thing y... | Creating alias to domain name with /etc/hosts |
1,478,993,911,000 |
I accidentally typed
ssh 10.0.05
instead of
ssh 10.0.0.5
and was very surprised that it worked. I also tried 10.005 and 10.5 and those also expanded automatically to 10.0.0.5. I also tried 192.168.1 and that expanded to 192.168.0.1. All of this also worked with ping rather than ssh, so I suspect it would work for ma... |
Quoting from man 3 inet_aton:
a.b.c.d Each of the four numeric parts specifies a byte of the
address; the bytes are assigned in left-to-right order to
produce the binary address.
a.b.c Parts a and b specify the first two bytes of the binary
address. Part c is interp... | How is it that missing 0s are automatically added in IP addresses? (`ping 10.5` equivalent to `ping 10.0.0.5`) |
1,478,993,911,000 |
I've heard that changing the hostname in new versions of fedora is done with the hostnamectl command. In addition, I recently (and successfully) changed my hostname on Arch Linux with this method. However, when running:
[root@localhost ~]# hostnamectl set-hostname --static paragon.localdomain
[root@localhost ~]# hostn... |
The command to set the hostname is definitely, hostnamectl.
root ~ # hostnamectl set-hostname --static "YOUR-HOSTNAME-HERE"
Here's an additional source that describes this functionality a bit more, titled: Correctly setting the hostname - Fedora 20 on Amazon EC2.
Additionally the man page for hostnamectl:
HOSTNAMECTL... | How to permanently change hostname in Fedora 21 |
1,478,993,911,000 |
As opposed to editing /etc/hostname, or wherever is relevant?
There must be a good reason (I hope) - in general I much prefer the "old" way, where everything was a text file. I'm not trying to be contentious - I'd really like to know, and to decide for myself if it's a good reason.
Thanks.
|
Background
hostnamectl is part of systemd, and provides a proper API for dealing with setting a server's hostnames in a standardized way.
$ rpm -qf $(type -P hostnamectl)
systemd-219-57.el7.x86_64
Previously each distro that did not use systemd, had their own methods for doing this which made for a lot of unnecessary... | What's the point of the hostnamectl command? |
1,478,993,911,000 |
I try to find a script to decrypt (unhash) the ssh hostnames in the known_hosts file by passing a list of the hostnamses.
So, to do exactly the reverse of:
ssh-keygen -H -f known_hosts
Or also, to do the same as this if the ssh config HashKnownHosts is set to No:
ssh-keygen -R know-host.com -f known_hosts
ssh-keyscan... |
Lines in the known_hosts file are not encrypted, they are hashed. You can't decrypt them, because they're not encrypted. You can't “unhash” them, because that what a hash is all about — given the hash, it's impossible¹ to discover the original string. The only way to “unhash” is to guess the original string and verify... | How to decrypt hostnames of a crypted .ssh/known_hosts with a list of the hostnames? |
1,478,993,911,000 |
I have several VMs and right now my command-line prompt looks like -bash-3.2$; identical on every VM, because it doesn't contain the host name.
I need to always see which VM I'm on using hostname before I do any operation. How can I add the host name to the shell prompt?
ENV:
CentOS/ssh
|
Just change the value of the $PS1 environment variable:
PS1="\h$ "
where \h is replaced with the hostname. Add that to /etc/bash.bashrc to set it permanent.
| How to show the host name in Linux commandline prompt |
1,478,993,911,000 |
How do I set the fully qualified hostname on CentOS 7.0?
I have seen a few posts online for example using:
$ sudo hostnamectl set-hostname nodename.domainname
However, running domainname returns nothing:
$ domainname
(none)
Also:
$ hostname
nodename.domainname
However,
$ hostname -f
hostname: Name or service not kn... |
To set the hostname do use hostnamectl, but only with the hostname, like this:
hostnamectl set-hostname nodename
To set the (DNS) domainname edit /etc/hosts file and ensure that:
There is a line <machine's primary, non-loopback IP address> <hostname>.<domainname> <hostname> there
There are NO other lines with <some ... | How to set the fully qualified hostname on CentOS 7.0? |
1,478,993,911,000 |
Display filter in form ip.src_host eq my.host.name.com yields no matching packets, but there is traffic to and from this host.
DNS name is resolved successfully, and filters using ip addresses like ip.src eq 123.210.123.210 work as expected.
|
The problem might be that Wireshark does not resolve IP addresses to host names and presence of host name filter does not enable this resolution automatically.
To make host name filter work enable DNS resolution in settings. To do so go to menu "View > Name Resolution" And enable necessary options "Resolve * Addresses... | How to filter by host name in Wireshark? |
1,478,993,911,000 |
I would like a command that will resolve a hostname to an IP address, in the same way that a normal program would resolve the hostname. In other words, it has to take into account mDNS (.local) and /etc/hosts, as well as regular DNS. So that rules out host, dig, and nslookup, since all three of those tools only use ... |
I think dscacheutil is what you're looking for. It supports caching, /etc/hosts, mDNS (for .local).
dscacheutil -q host -a name foo.local
Another option is dns-sd
dns-sd -q foo.local
More information about dnscacheutil.
| Mac OS command to resolve hostnames like "getent" on Linux |
1,478,993,911,000 |
I logged in for the first time, opened terminal, and typed in ‘hostname’. It returned ‘localhost.localdomain.com’. Then I logged as the root user in terminal using the command, ‘su –‘, provided the password for the root user and used the command ‘hostname etest’ where etest is the hostname I’d like my machine to have.... |
On RHEL and derivatives like CentOS, you need to edit two files to change the hostname.
The system sets its hostname at bootup based on the HOSTNAME line in /etc/sysconfig/network. The nano text editor is installed by default on RHEL and its derivatives, and its usage is self-evident:
# nano /etc/sysconfig/network
Yo... | How to change the hostname of a RHEL-based distro? |
1,478,993,911,000 |
When I install sendmail from the debian repos, I get the following output:
Disabling HOST statistics file(/var/lib/sendmail/host_status).
Creating /etc/mail/sendmail.cf...
Creating /etc/mail/submit.cf...
Informational: confCR_FILE file empty: /etc/mail/relay-domains
Informational: confCT_FILE file empty: /etc/mail/tru... |
It's referring to this page from the readme, which tells you how to specify your hostname. It's warning you that your hostname won't work outside your local network; sendmail attaches your hostname as the sender of the message, but it's going to be useless on the other end because people outside your local network can... | What is sendmail referring to here? |
1,478,993,911,000 |
It seems that wildcards are not supported in the /etc/hosts file.
What is the best solution for me to resolve all *.local domains to localhost?
|
You'd really need to run your own DNS server and use wildcards. Exactly how you'd do that would depend on the DNS package you ran.
| Wildcard in /etc/hosts file |
1,478,993,911,000 |
Am am currently visiting TU Wien and today I connected my Debian Linux laptop to their eduroam wlan using wpa_supplicant and the credentials of my home institute - as always when I am visiting another scientific institution.
When I opened a terminal I noticed that my command promt was showing a different host name, an... |
Some DHCP servers send out host names. Clients can accept or ignore such offers.
Have a look at your local /etc/dhcp/dhclient.conf file to inspect your current configuration. There is a list of
request entities one of which will probably readhost-name. For more information check out the man page of dhclient.conf.
| Host name changed remotely by wifi? |
1,478,993,911,000 |
Heyo! I'm currently working on a non-lfs system from scratch with busybox as the star. Now, my login says:
(none) login:
Hence, my hostname is broken. hostname brings me (none) too.
The guide I was following told me to throw the hostname to /etc/HOSTNAME. I've also tried /etc/hostname. No matter what I do, hostname r... |
The hostname commands in common toolsets, including BusyBox, do not fall back to files when querying the hostname.
They report solely what the kernel returns to them as the hostname from a system call, which the kernel initializes to a string such as "(none)", changeable by reconfiguring and rebuilding the kernel.
(In... | What's the default file for `hostname`? |
1,478,993,911,000 |
I am running a RHEL 5.7 and the hostname command gives me the correct hostname.
But hostname -s and hostname -f return: Unknown host. Why?
|
(copied from one of my answers on SF)
The hostname command returns results from DNS and /etc/hosts.
hostname is equivilant to uname -n and is the actual "hostname" or "nodename" of the box.
All the other hostname arguments use this nodename to look up info.
So before going any further, I should explain the /etc/host... | linux hostname -f command is not working on RHEL |
1,478,993,911,000 |
How can you determine the hostname associated with an IP on the network? (without configuring a reverse DNS)
This was something that I thought was impossible. However I've been using Fing on my mobile. It is capable of finding every device on my network (presumably using an arp-scan) and listing them with a hostname... |
The zeroconf protocol suite (Wikipedia) could provide this information.
The best known implementations are AllJoyn (Windows and others), Bonjour (Apple), Avahi (UNIX/Linux).
Example showing a list of everything on a LAN (in this case not very much):
avahi-browse --all --terminate
+ ens18 IPv6 Canon MG6650 ... | How can you determine the hostname associated with an IP on the network? |
1,478,993,911,000 |
I need to add a check if the hostname is already present in the known_hosts file.
Normally I would do something like that:
ssh-keygen -H -F hostname
However, that does not seem to work for me in this particular case. I connect to the host using port 2102, like that:
ssh user@myhost -p 2102
I was asked to add the hos... |
You can use this format: [hostname]:2121, as it is stored in the known_hosts file (note, you need to use the square brackets!):
ssh-keygen -H -F "[hostname]:2121"
Proof of concept (transcript of my minimal test case):
$ echo "[hostname]:2121 ssh-rsa AAA...==" > known_hosts
$ ssh-keygen -Hf known_hosts
known_hosts up... | Check presence of a hostname under custom port in known_hosts |
1,478,993,911,000 |
I'm trying to figure out more ways to see if a given host is up, solely using shell commands (primarily bash). Ideally, it would be able to work with both hostnames and IP addresses. Right now the only native way I know of is ping, perhaps integrated into a script as described here. Any other ideas?
|
Ping is great to get a quick response about whether the host is connected to the network, but it often won't tell you whether the host is alive or not, or whether it's still operating as expected. This is because ping responses are usually handled by the kernel, so even if every application on the system has crashed ... | Shell command/script to see if a host is alive? |
1,478,993,911,000 |
In the few years I've been using Linux as my main system, specifically Fedora, I've always seen my hostname set to just "localhost", with the exception of when I connect to some networks and it becomes my IP. Today I experienced the following behavior which I'm having trouble understanding though.
I set up an Ubunt... |
The hostnameprogram performs a uname syscall, as can be seen from running:
strace hostname
...
e="Linux", nodename="my.hostname.com", ...}) = 0
...
From the uname syscall man page, it says the syscall retrieves the following struct from the kernel:
struct utsname {
char sysname[]; /* Operating sys... | What determines the Linux hostname? |
1,478,993,911,000 |
We were trying to install our software on an Ubuntu machine. To do so, we needed root privileges. Basically, all we needed to do was run a runnable jar like: sudo java -jar runnableJar.jar.
All such commands would return: Unable to resolve host xxxxx.
The /etc/hosts file had the incorrect hostname listed against the... |
Since the sudoers file permits the specifying of hostnames in the rules, sudo needs to know what the name of your Ubuntu machine is.
Because of this, sudo collects a list of all interfaces on your Ubuntu machine (loopback and "real"). See relevant section from sudo source code for interfaces.c, at the link below.
htt... | Why does sudo need the loopback interface? |
1,478,993,911,000 |
During Debian installation, I set my hostname to the wrong value, and now I would like to correct that.
|
The hostname is stored in three different files:
/etc/hostname Used as the hostname
/etc/hosts Helps resolving the hostname to an IP address
/etc/mailname Determines the hostname the mail server identifies itself
You might want to have a deeper look with grep -ir hostname /etc
Restarting affected services might be a... | How to change a hostname |
1,478,993,911,000 |
More of a Amazon Web Services EC2 question, hopefully not too off topic. I have a vanilla Ubuntu instance with them, and powered it off. On reboot couldn't ssh to the FQDN because the external IP address had changed.
It costs extra for a "static", or even static, IP address? I would settle for semi-permanent. Elas... |
The main difference between the two is that:
You will lose your Public IP when you Stop and Start the instance, while the EIP remains linked to the instance even after the Stop/Start operation (or until you don't explicitly detach it from the instance)
Concerning the costs, there's no recurring fee you will pay ... | How is an Elastic IP address different from a static IP address? |
1,478,993,911,000 |
While writing a script, I wanted to reference a machine by the computer name that I gave it (e.g. "selenium-rc"). I could not ping it using "selenium-rc", so I tried the following commands to see if the name was recognized.
> traceroute 192.168.235.41
traceroute to 192.168.235.41 (192.168.235.41), 64 hops max, 52 byte... |
Generally, in Linux, and Unix, traceroute and ping would both use a call to gethostbyname() to lookup the name of a system. gethostbyname() in turn uses the system configuration files to determine the order in which to query the naming databases, ie: /etc/hosts, and DNS.
In Linux, the default action is (or maybe used... | How does traceroute resolve names? |
1,478,993,911,000 |
I know that pwd gives the current working directory, hostname gives the current host and whoami gives the current user. Is there a single unix command that will give me the output of
whoami@hostname:pwd
so that I can quickly paste the output into an scp command?
|
Not a single command as far as I know, but this does what you need:
echo "$(whoami)@$(hostname):$PWD"
You could make that into an alias by adding this line to your shell's rc file (~/.bashrc, or ~/.zshrc or whatever you use):
alias foo='echo "$(whoami)@$(hostname):$PWD"'
| A command that gives username@hostname:pwd |
1,478,993,911,000 |
I have a Centos 5.8 server. How can I add my server IP address 192.168.20.254 so that it reflects when I run the command hostname -i
At the moment the command only shows the loopback IP 127.0.0.1 and the software I am trying to install complains that the server IP is not reflected here.
|
Edit file /etc/hosts and add line:
192.168.20.254 this.is.my.host
Of course instead of this.is.my.host enter proper hostname. You can check it by running hostname without any parameters.
| How to add an IP to hostname file |
1,478,993,911,000 |
What is the difference between uname -n and hostname? Are there any real differences in what they return? Are there any differences in availability on different OSes? Is one of them included in POSIX and the other not?
|
There is no difference. hostname and uname -n output the same information. They both obtain it from the uname() system call.
One difference is that the hostname command can be used to set the hostname as well as getting it. uname cannot do that. (Normally this is done only once, early in the boot process!)
| uname -n vs hostname |
1,478,993,911,000 |
In another question, I found that Puppet was generating certificates for my machine's FQDN but not the simple host name. In that example, kungfumaster was the hostname and was the value retrieved by running hostname. Puppet was generating certificates which specified the FQDN kungfumaster.domain.com.
How did Puppet d... |
It appears that under-the-hood, Puppet uses Facter to evaluate the domain names:
$ facter domain
domain.com
$ facter hostname
kungfumaster
$ facter fqdn
kungfumaster.domain.com
The answer is in the relevant Facter source code.
It does the following in order and uses the first one that appears to contain a domain name... | Determine FQDN when hostname doesn't give it? |
1,478,993,911,000 |
My server is CentOS 7.1. After reboot the hostname is overwritten by the transient hostname (mail) and I can't find a way to avoid that.
Maybe AutoDNS and the MX record mail causes that?
/etc/hostname contains the correct value
hostnamectl --transient set-hostname my.desired.name is working but only until next reboot... |
Finally I got it.
Our Hosting Provider (Host Europe) has an option in the Controlpanel for each server (virtual root server). On the page "Hostname / RDNS" there is an input field "Hostname:". I changed it to the correct value and now it works as expected.
| Avoid overwriting of hostname by transient hostname at reboot |
1,478,993,911,000 |
I have a firstboot.service that, from a stock OS image creates a unique hostname based on the MAC of the primary ethernet adapter. It runs as expected during boot but the hostname that gets registered with DHCP is still the default hostname as set from the kernel. So after the device boots, I can ping it at defaultn... |
Nothing ensures that your firstboot.service runs before systemd-networkd is started. You have to use
Wants=network-pre.target
Before=network-pre.target
instead of Before=network.target to achieve that. As man systemd.special explains:
network-pre.target:
This passive target unit may be pulled in by services that ... | Set hostname on first boot before network.service |
1,478,993,911,000 |
I have several log files that contain a bunch of ip addresses. I would love to be able to pipe the data through a program that would match and resolve ip addresses.
I.E.
cat /var/log/somelogfile | host
which would turn a line like
10:45 accessed by 10.13.13.10
into
10:45 accessed by myhostname.intranet
My thoug... |
Here's a quick and dirty solution to this in Python. It does caching (including negative caching), but no threading and isn't the fastest thing you've seen. If you save it as something like rdns, you can call it like this:
zcat /var/log/some-file.gz | rdns
# ... or ...
rdns /var/log/some-file /var/log/some-other-file ... | resolve all ip addresses in command output using standard command line tools |
1,351,783,683,000 |
I'm using top with tmux to monitor the most-CPU-consuming processes on different computers. How can I get the hostname to be displayed in each pane? Can I tell top to display the hostname somehow?
|
As far as I see it, there is no possibility to do it in top. I would suggest using htop. If you open the programm press F2 and move with Tab to the column available meters. You'll find an entry hostname and can place it by pressing F5 or F6 to left or right side.
| show hostname in top |
1,351,783,683,000 |
So I try to do:
ssh $(hostname)
and it tells me:
ssh: Could not resolve hostname woofy: Name or service not known
It knows that its own hostname is "woofy"; why can't it connect to itself?
|
So we know hostname returns woofy. But that name can't be resolved to an IP address.
The short answer is that you need to add an entry for woofy in /etc/hosts. Make it resolve to 127.0.0.1. Or if your system is IPv6-capable, ::1.
Keep a backup of the previous version of /etc/hosts in case you make a mistake (I... | Unable to resolve hostname |
1,351,783,683,000 |
In a remote shell, how can I find the domain name of the computer from which I logged into the remote machine?
Example: My local machine is mi.pona.com. On this machine I run
ssh [email protected]
to login into the remote machine sina.pona.com. In the shell which opens (running on the remote machine) I want to find... |
On my Red Hat 7 machine, I run who am i or who am I or who -m.
The last column will show the machine name where I logged in from (in parenthesis). If I am on my local machine, the last column will show my console/display ID. On my machine it is (:0).
Caveat
This only works on an interactive shell.
ssh ScottieH@Remote... | In a remote shell, how can I find out from which computer I logged into the remote machine? [duplicate] |
1,351,783,683,000 |
I want a host section in my ssh config that matches any local IP:
Host 10.* 192.168.*.* 172.31.* 172.30.* 172.2?.* 172.1?.*
setting
setting
...
This works as long as I connect directly to a relevant IP. If I however connect to a hostname that later resolves to one of these IPs, the section is ignored.
sshd has ... |
You can't do that using only ssh_config options, but there is exec option, which can do that for you:
Match exec "getent hosts %h | grep -qE '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'"
setting
| ssh_config: Add a host section that matches IPs even when connecting via hostname |
1,351,783,683,000 |
I have a problem when I send a mail to [email protected] for [email protected] My emails has bounced for this error: status=bounced (mail for orbialia.es loops back to myself)
May 9 09:33:58 ns3285243 postfix/smtpd[1606]: connect from localhost.localdomain[127.0.0.1]
May 9 09:33:58 ns3285243 postfix/smtpd[1606]: 1EF... |
From comment:
The problem in this case is that the domain has not been marked as active, so when mysql is queried for active domains this one is not returned.
| Postfix email bounced (mail for domain loops back to myself) |
1,351,783,683,000 |
I configured my machine as the following hostname ( in reshat 7.2 )
digi.master01.usa.com
but my prompt is like this
[root@digi ]#
while we want
[[email protected] ]#
any idea how to change it in linux configuration?
|
In bash you can use two special characters regarding hostname:
\h to get host name up to the first dot
\H to get full host name
If you want anything else you need to make your own version for example with HOSTNAME variable:
[root@digi ]# HOSTNAME=digi.master01.usa.com # this should be set automatically by bash
[r... | Bash prompt takes only the first word of a hostname before the dot |
1,351,783,683,000 |
So I changed the name of my computer recently, by editing /etc/hostname. The bash prompt is user@name, so I know it has worked.
But in emacs, in the window bar it says [email protected]. Tiscali is my internet provider. Before I changed it, emacs just had emacs@oldname in the window bar.
How can I remove my IP's name ... |
The name in /etc/hostname is what your computer thinks it's called. That's often what is meant by hostname.
Computers connected to the Internet (including intranets) have names; more precisely, most Internet network interfaces have a name associated with their IP address. Internet nodes that are not routers generally ... | Why is my hostname different in Emacs? |
1,351,783,683,000 |
I'm running an arch system with KDE4/Plasma, wpa_supplicant, networkmanager, systemd ...
# cat /proc/version
Linux version 5.0.0-arch1-1-ARCH (builduser@heftig-18825) (gcc version 8.2.1 20181127 (GCC)) #1 SMP PREEMPT Mon Mar 4 14:11:43 UTC 2019
The content of my /etc/hostname reads localhost.
After boot, the shel... |
Ivanivan's answer (tuning dhcpcd.con), though plausible, didn't work in my case. So I suspect it is not about DHCP. I stumbled upon this post which told me that the problem is not about DHCP but about NetworkManager. Adding the following to /etc/NetworkManager/NetworkManager.conf solved the problem for me:
[main]
plug... | NetworkManager interferes with hostname configuration |
1,351,783,683,000 |
I have a following bash prompt string:
root@LAB-VM-host:~# echo "$PS1"
${debian_chroot:+($debian_chroot)}\u@\h:\w\$
root@LAB-VM-host:~# hostname
LAB-VM-host
root@LAB-VM-host:~#
Now if I change the hostname from LAB-VM-host to VM-host with hostname command, the prompt string for this bash session does not change:
r... |
Does Debian really pick up a changed hostname if PS1 is re-exported, as the other answers suggest? If so, you can just refresh it like this:
export PS1="$PS1"
Don't know about debian, but on OS X Mountain Lion this will not have any effect. Neither will the explicit version suggested in other answers (which is exactl... | How to change bash prompt string in current bash session? |
1,351,783,683,000 |
I want to have the FQDN as bash prefix instead of just using the hostname. So I can change
root@web: ~$
to
[email protected]: ~$
I already know that that is possible by using:
PS1="\[\u@$(hostname -f): \w\]\$ "
But that is not persistent - it is always the default hostname when I re-login. So is there a way to make... |
Thanks to @dawud and @EsaJokinen comments I found a solution. Replacing
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
with
PS1="\[\u@$(hostname -f): \w\]\$ "
in
/etc/bash.bashrc
does the job on Debian 7
| Persistent Bash Prompt Prefix Linux |
1,351,783,683,000 |
I have tried hostname and ping in a cluster machine, with different outputs. I am wondering what is the difference between the two? For example, on the same machine, hostname outputs node4.XXX and
ping -c 1 $(hostname)
outputs pc333.XXX.
|
The hostname command outputs the hostname of the system from the systems local hostname configuration (could be /etc/hostname or /proc/sys/kernel/hostname or other depending on OS).
The command ping -c 1 <hostname> is going to perform a lookup through the libc resolver (which may or may not be DNS. e.g., /etc/hosts is... | Why the difference between network addresses reported by hostname and ping? |
1,351,783,683,000 |
I am using zsh with oh-my-zsh. Unfortunately, oh-my-zsh does not use file ~/.ssh/config for hostname auto-completion (see Issue #1009, for instance).
This could easily archived by the following code:
[ -r ~/.ssh/config ] && _ssh_config=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) || _ssh_config=()
zstyle ':compl... |
I think you need to retrieve the existing items and append yours.
zstyle -s ':completion:*:hosts' hosts _ssh_config
[[ -r ~/.ssh/config ]] && _ssh_config+=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p'))
zstyle ':completion:*:hosts' hosts $_ssh_config
| How to append / extend zshell completions? |
1,351,783,683,000 |
I want to use SSH to access a remote machine. However, I do not know how to find the HostName of a machine. I tried using the hostname command, but that only gives the local address of the machine, which (I think) can be same across different machines.
When I try ssh name with name being the hostname returned by the ... |
To access a remote machine using ssh, you will need to know either its public host name or its IP address.
You will also need to have either a username and password for an account on the other machine or an SSH private key corresponding to an SSH public key installed on a particular account on the machine you're conne... | Finding hostname to run SSH [closed] |
1,351,783,683,000 |
I have a voyage 2.6.38 machine running DNSMASQ for a DHCP server and I would like to get the hostnames of the clients that acquire DHCP leases. How would I go about doing this?
|
If the host sends its name you can retrieve it from DNS. If you know its IP address you just do a reverse lookup on the IP address. One of these commands should work (use the host's IP address in place of 192.0.32.10):
host 192.0.32.10
nslookup 192.0.32.10
You can retrieve a list of all leases including the name p... | Get client hostnames from DHCP |
1,351,783,683,000 |
What is the right thing to set a computer's hostname to? (/bin/hostname, /etc/hostname, sethostname(2), etc.)
I usually just use the "name" part, and it works perfectly (for me at least), but I've seen it implied in some places that I should use the entire "name.domain.tld" instead... which just doesn't feel "right" f... |
Just the name as you already do. A hostname shouldn't contain any domainname.
| `hostname` - host name or FQDN? |
1,351,783,683,000 |
How to prevent dhcpcd from setting hostname got from server? Change of it breaks a lot of things (including X session).
My current distribution is Gentoo, init system is systemd and dhcpcd is spawn by networkmanager.
|
From n.m.'s link - the solution is described on NM webpage under 'Persistent Hostname'. One need to add to /etc/NetworkManager/NetworkManager.conf:
[main]
plugins=keyfile
[keyfile]
hostname=deepspace9
| Prevent dhcpcd from setting hostname |
1,351,783,683,000 |
On my Fedora 19 system, I am able to change the system hostname with hostnamectl. This allows me to set several things, such as the static (normal) hostname, as well as a "pretty" hostname.
Is there a simple command that retrieves the pretty hostname, from a bash prompt?
hostname returns the static hostname, and the ... |
As per man hostnamectl:
The static host name is stored in /etc/hostname, see hostname(5) for more information. The pretty host name,
chassis type and icon name are stored in /etc/machine-info, see machine-id(5).
Therefore, if you have set a pretty hostname using the command
hostnamectl set-hostname --pre... | Obtain the "pretty" hostname in bash |
1,351,783,683,000 |
In my local wifi, I can find out the IP and MAC of another computer which also runs Lubuntu, and whose hostname is known to me.
$ sudo arp-scan olive
[sudo] password for t:
Interface: wlx801f02b5c389, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.9 with 1 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.... |
Install nmap for whatever flavour of Linux you are on.
Then perform:
nmap -sP xxx.xxx.xxx.xxx/nn
Where xxx.xxx.xxx.xxx/nn is your IP and subnet mask bits. For example, if you were on 192.168.1.0 network with a subnet mask of 255.255.255.0 you would do:
nmap -sP 192.168.1.0/24
Nmap will ping scan all IPs and try to ... | How can I find out the hostnames of other computers in the same local network? |
1,351,783,683,000 |
I was looking at bind9-host
shirish@debian:"04 Jan 2020 15:48:02" ~$ aptitude show bind9-host=1:9.11.5.P4+dfsg-5.1+b1
Package: bind9-host
Version: 1:9.11.5.P4+dfsg-5.1+b1
State: installed
Automatically installed: no
Priority: standard
Section: net
Maintainer: Debian DNS Team <[email protected]>
... |
host is not deprecated by Internet Systems Consortium, the BIND company. It does not even deprecate nslookup as it once did.
This deprecation of host was done in 2018 by a Debian Developer, on xyr own initiative, in response to a 2013 Debian bug report about the package description that did not actually mention depre... | why host from bind9-host is/was deprecated and when? |
1,351,783,683,000 |
I need to change the hostname of a system without rebooting it. I'm running CentOS 7 and have the correct hostname in the /etc/hostname file but I'm still showing the old hostname at prompt. I know that when I reboot the system it will check the hostname file and apply it, but is there anyway for me to update that wit... |
You should be able to do this using the hostname command:
hostname -F /etc/hostname
After this change, the previous hostname will still show at your current prompt. To see the change without rebooting, enter a new shell. If you are using bash, type:
bash
Your new hostname should now be displayed.
| Need to force hostname update without restart |
1,351,783,683,000 |
I have a machine that I can only access using SSH.
I was messing with the hostnames, and now it says:
ssh: unable to resolve hostname
I know how to fix it in /etc/hosts.
Problem is, I need sudo to fix them because my normal account doesn't have permissions.
What's the best way to fix the hosts?
|
You don't need sudo to fix that, try pkexec,
pkexec nano /etc/hosts
pkexec nano /etc/hostname
After running pkexec nano /etc/hosts, add your new hostname in the line that starts with 127.0.1.1 like below,
127.0.0.1 localhost
127.0.1.1 your-hostname
And also don't forget to add your hostname inside /etc/hostname ... | How to edit /etc/hosts without sudo? |
1,351,783,683,000 |
Sorry my knowledge of Linux bash commands is pretty basic, I've been searching for a while but I'm not 100% sure what I need to search for.
I was wondering if there's a way to grab the current logged in users remote host name in a Linux bash script? I have a script in which I need to log each time a user runs it. I'm ... |
Better to use the command who am i so that you don't get the duplicate info and have to parse it when using just a plain who.
$ who am i
sam pts/6 2013-07-22 13:21 (192.168.1.110)
Humourously you can also use this:
$ who mom likes
sam pts/6 2013-07-22 13:21 (192.168.1.110)
You can parse it us... | Obtaining remote host name in bash script |
1,351,783,683,000 |
I have this weird problem. I need to access a website that contains an underscore from Linux. The hostname is invalid and Linux does treat it as such.
The problem is that access from Windows seems to work just fine and therefore the admin won't fix it.
Is there any way to access such site?
EDIT:
The hostname is: _nyx.... |
Since you can find the IP with host, add an entry to your /etc/hosts file with a new name to the same IP.
/etc/hosts
198.100.51.37 u_nyx.isthereanydeal.com
Then:
$ ping -c 1 u_nyx.isthereanydeal.com
PING u_nyx.isthereanydeal.com (198.100.51.37): 56 data bytes
64 bytes from 198.100.51.37: icmp_seq=0 ttl=48 time=69.15... | Is there any way to access a hostname containing an underscore? |
1,351,783,683,000 |
In order to have an alias for my server, which can be seen in a "hostname -a" command, I edited the /etc/hosts file to add the alias at the end of the entry containing the hostname.
For example, my hostname is host1 and I want to have alias hostalias, I have below entry in /etc/hosts:
192.168.0.1 host1 hostalias
... |
@StephaneChazelas is right in this comment.
Possibly you have a name service cache daemon. Try after sudo nscd -i hosts (to invalidate the host cache).
I can't make a comment the answer of a question so I answer this question myself.
| in which file is hostname alias persistent, if not /etc/hosts? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.