If you need to compare two text files in Unix, you're mostly likely to use the diff command.
Today I'll talk about the simplest scenario: you want to compare two files and understand if there are any differences.
Unix/Linux tutorials for beginners
If you need to compare two text files in Unix, you're mostly likely to use the diff command.
Today I'll talk about the simplest scenario: you want to compare two files and understand if there are any differences.
If you know the name of a particular user on your Unix system and just want to confirm the primary Unix group (gid) of this individual, just use the id command:
$ id -g greys 115
[Read more…] about How To Find Out Which Group a Unix User Belongs To
There's quite a few ways to confirm a user ID (uid) in Unix.
This is probably one of the easiest ways to find out a uid of a particular user in your system:
# id -u greys 500
The most common way of using the id command is even simpler, and it gives you all the information about a user you may need:
# id greys uid=500(greys) gid=500(greys) groups=500(greys)
This not only shows you the user id (uid), but also confirms user's group id (gid) and all the rest Unix groups a user belongs to.
If you're a really curious mind, you won't be satisfied with simply knowing the current release of your RedHat Linux, that's why there's a few more commands you could use to satisfy your interest.
If you simply want to confirm whether you're using a RHEL4, RHEL5 or any of the previous RedHat Linux releases, this is the first place to look:
bash-3.1$ cat /etc/redhat-release Red Hat Enterprise Linux Client release 5 (Tikanga)
Next step is to find out the exact Linux kernel version on your system, and also confirm whether it's 64-bit or not:
bash-3.1$ uname -a Linux rhserver123 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:14 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
For the most curious ones, here's the last command. Use it to confirm who and when compiled the RedHat kernel you're using, and what gcc compiler was used in the build process.
bash-3.1$ cat /proc/version Linux version 2.6.18-8.el5 ([email protected]) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1 SMP Fri Jan 26 14:15:14 EST 2007
Quite often there's a need for you to take a screenshot of your Unix desktop, and as always there's a number of ways to do it. Today I'm going to cover the command line approach to taking screenshots.
Most modern Unix desktop systems come with Gnome desktop environment by default, and use Xorg as their default X11 server. This means you are likely to have the xwd tool in your OS, which allows you to take screenshots.
Mounting an ISO image of a CD/DVD before burning it is one of the basic steps to verifying you're going to get exactly the desired result. It's also a neat trick to access files from a CD/DVD image when you only need a file or two and not a whole CD. Why burn it at all when you can access files much quicker and easier by simply mounting the ISO image?
Every Unix OS has a way to access ISO filesystem, and today I'll only give you examples for Linux and Solaris. In both cases, the two things you need for the example to work are the ISO image itself and an available mount point (basically, an empty directory) on your filesystem to mount it under.
# mount -o loop /net/server/linux-bootcd.iso /mnt
If you run your Ubuntu system behind a firewall and have to use proxy server for http and ftp access, then your apt-get on a newly installed Ubuntu system will probably not work.
To make it use proxy, simply set the http_proxy environment variable. Once you get it working (try something like apt-get update), you'll probably want to add it to your .bashrc file.
Different UNIX-like operating systems store information about their release versions differently. If you know what OS you have, but not sure about the version, then here's how you can find out:
bash-3.1$ cat /etc/redhat-release Red Hat Enterprise Linux Client release 5 (Tikanga)