Solve your UNIX identity crisis
If you frequently login to multiple UNIX systems as different users, it is sometimes helpful to make sure you know who you are. The who command, in addition to telling you who else is online, can tell you who you are logged in as and on what tty port.
To determine who you logged into your current session as in most flavors of UNIX, use the following command:
who -m
As a more memorable alternative, you can use:
who am i
In fact, most versions of who just look for two or more arguments and, if present, generates output equivalent to the -m option. So, the following will probably also work and are a little like primitive Easter eggs:
who is the man
who wants cake
who mom likes
who wants cake
who mom likes
Also see ...
Cut and paste text in vi or vim
H3Cutting and pasting text in an editor is a basic requirement. This recipe describes the cut and paste functions of vi and vim./H3PCutting text in vi/vim is achieved with the various delete commands which are summarized below: br / br /div class="code"dd Dele
H3Cutting and pasting text in an editor is a basic requirement. This recipe describes the cut and paste functions of vi and vim./H3PCutting text in vi/vim is achieved with the various delete commands which are summarized below: br / br /div class="code"dd Dele
Create a TAR archive of a directory
H3A common task in UNIX operating systems is creating an archive of many files or directories in a single file. The tar command is one option for archiving and has many options and can do many things./H3PIn a simple example, you can create a file called archive.tar of all the files and subdir
H3A common task in UNIX operating systems is creating an archive of many files or directories in a single file. The tar command is one option for archiving and has many options and can do many things./H3PIn a simple example, you can create a file called archive.tar of all the files and subdir
UNIX recursive directory listing
H3Listing the contents of a directory and all subdirectories, a recursive listing, is sometimes useful. This recipe describes some techniques for listing files recursively/H3PThe simplest method of performing a recursive directory listing is with the ls command: br / br /div class="code"
H3Listing the contents of a directory and all subdirectories, a recursive listing, is sometimes useful. This recipe describes some techniques for listing files recursively/H3PThe simplest method of performing a recursive directory listing is with the ls command: br / br /div class="code"
Sniffing with TCPDump
H3How to sniff a network with TCPDump. TCPDump comes installed on Linux by default. You will have to install the package on Solaris. This is just a simple sniff./H3PTo sniff all traffic accross an interface (port mon is your friend) br / br /span style="color: blue"tcpdump w testsniff
H3How to sniff a network with TCPDump. TCPDump comes installed on Linux by default. You will have to install the package on Solaris. This is just a simple sniff./H3PTo sniff all traffic accross an interface (port mon is your friend) br / br /span style="color: blue"tcpdump w testsniff
Tar and compress a file in one step
H3Creating a compressed archive in UNIX in a single step is faster and is often the only method when disk space is limited./H3PTo archive and compress a directory called 'target' in the current working directory into a file called target.tgz use: br / br /div class="code"tar cf target
H3Creating a compressed archive in UNIX in a single step is faster and is often the only method when disk space is limited./H3PTo archive and compress a directory called 'target' in the current working directory into a file called target.tgz use: br / br /div class="code"tar cf target
