How to find the differences between two files over SSH
Answer:
If the files you want to compare are on different machines, you can combine ssh and diff for the comparsion.
E.g.
ssh [email protected] "cat /tmp/foo.txt" | diff - /tmp/bar.txt
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to find the differences between two files over SSH
Answer:
If the files you want to compare are on different machines, you can combine ssh and diff for the comparsion.
E.g.
ssh [email protected] "cat /tmp/foo.txt" | diff - /tmp/bar.txt
How to find the differences between two files
Answer:
Use the diff command
E.g.
diff foo.txt bar.txt
How to change hostname in Ubuntu?
Answer:
To see the current hostname setting, see
# cat /etc/hostname
www.example.com
To change it, edit this file
sudo vi /etc/hostname
Save it and reboot your system and perform the step above to check again.
How to display swap information on Linux?
Answer:
With the following command
# cat /proc/swaps
Filename Type Size Used Priority
/dev/md4 partition 4192824 224 -1
It will display the current swap information.
How to check which directory used up most of the disk space?
Answer:
For example, assume you are at /usr/local, you want to generate a report on disk space usage on all the sub directories, you can use the following command
# du -k * | sort -n
.
.
14564 share/man/man3
14816 share/man
16624 share/perl/5.10.0
16628 share/perl
33060 share
It will give you a very clear and useful report.