Archive for
October, 2008

Find IP address from remote end of a TCP socket

by
on
October 31, 2008

In C or C++ it is fairly simple to find the IP address of the remote end of a TCP socket. The following example shows how to do this using the getpeername() and inet_ntoa() system calls. int sockfd; int len; char * hostip; struct sockaddr_in sin; len = sizeof(sin); if (0 != getpeername(sockfd, (struct sockaddr [...]

Read More
No Comments
C

Find your MAC address with ifconfig

by
on
October 30, 2008

You can find the MAC address of your system at the command line by using the ifconfig command. The ifconfig command will show you information on all your network interfaces. If no arguments are given ifconfig displays the status of the currently active interfaces. You have to run this command as root or use sudo. [...]

Read More
No Comments
system administration

Find your IP address with ifconfig

by
on
October 30, 2008

You can find the IP address of your system at the command line by using the ifconfig command. The ifconfig command will show you information on all your network interfaces. If no arguments are given ifconfig displays the status of the currently active interfaces. You have to run this command as root or use sudo. [...]

Read More
No Comments
system administration

Run a command at boot with Gentoo

by
on
October 27, 2008

Normally in Gentoo you would want to create an init script via rc-update to start a service at boot. However if there are a few miscellaneous commands you would like to run you can add them to local.start. The local.start init script is similar to rc.local in other distributions. It is the last init script [...]

Read More
5 Comments
gentoo

Disable ext3 boot-time check with tune2fs

by
on
October 26, 2008

The ext3 file system forces an fsck once it has been mounted a certain number of times. By default this maximum mount count is usually set between 20-30. On many systems such as laptops which can be rebooted quite often this can quickly become a problem. To turn off this checking you can use the [...]

Read More
1 Comment
system administration

Delete a specific line from a text file with sed

by
on
October 26, 2008

At some point you may have the need to remove all lines within a text file that match a certain pattern. Accomplishing this is easy with the sed command. Here is the command format. $ sed -i ‘/PATTERN/ d’ file.txt The ‘-i‘ option allows you to edit the specified file in place. PATTERN is a [...]

Read More
4 Comments
bash

List all open files with lsof

by
on
October 24, 2008

The lsof command stands for “list open files”. It can show all open files as well as sockets, memory mapped libraries, directories, pipes, and network sockets. It is an incredibly powerful tool which you can use to gather detailed information about what is happening on your system. If you run lsof as a normal user [...]

Read More
No Comments
commands

RPM Cheat Sheet

by
on
October 22, 2008

RPM stands for Red Hat Package Manager. There are a variety of distributions besides Red Hat that use RPM to manage packages including Fedora, Mandriva, SUSE, CentOS, and Yellow Dog Linux among others. RPM uses a database to keep track of what packages have been installed on the system and where they are located. This [...]

Read More
No Comments
red hat

How to correctly use LD_LIBRARY_PATH

by
on
October 22, 2008

The LD_LIBRARY_PATH environment variable contains a colon separated list of paths that the linker uses to resolve library dependencies of ELF executables at run-time. These paths will be given priority over the standard library paths /lib and /usr/lib. The standard paths will still be searched, but only after the list of paths in LD_LIBRARY_PATH has [...]

Read More
5 Comments
system administration

Search for files with the find command

by
on
October 20, 2008

The find command allows you to recursively search and locate files on your system based on specific criteria. You can search by name, owner, group, type, permissions, date, as well as many others. The find command uses the following format: find [search_path(s)] [search_criteria] The following is the most basic way to run the find command. [...]

Read More
No Comments
commands
Copyright 2008-2010 WiredRevolution.com. All rights reserved.