Archive for the 'General' Category

SBDavid

lsof - list open files example

To list all open files, use:

lsof

To list all open Internet, x.25 (HP-UX), and UNIX domain files, use:

lsof -i -U

To list all open IPv4 network files in use by the process whose PID is 1234, use:

lsof -i 4 -a -p 1234

Presuming the UNIX dialect supports IPv6, to list only open IPv6 network files, use:

lsof -i 6

To list all files using any protocol on ports 513, 514, or 515 of host wonderland.cc.pur-due.edu, use:

lsof -i @wonderland.cc.purdue.edu:513-515

To list all open files for login name “abe”, or user ID 1234, or process 456, or pro-cess 123, or process 789, use:

lsof -p 456,123,789 -u 1234,abe

To list all open files on device /dev/hd4, use:

lsof /dev/hd4

To find the process that has /u/abe/foo open, use:

lsof /u/abe/foo

To send a SIGHUP to the processes that have /u/abe/bar open, use:

kill -HUP `lsof -t /u/abe/bar`

To find any open file, including an open UNIX domain socket file, with the name /dev/log,use:

lsof /dev/log
SBDavid

proc pseudo-filesystem in Linux

proc pseudo-filesystem in Linux

proc-pseudo-filesystem in Linux The Linux process pseudo-filesystem, the /proc directory. Every process on the system has a directory here with its name on it, inside of which lies many things — including an fd (”file descriptor”) subdirectory containing links to all files that the process has open. Even if a file has been removed from the filesystem, a copy of the data will be righ there:

/proc/process id/fd/file descriptor

To know where to go, you need to get the id of the process that has the file open, and the file descriptor. These you get with lsof, whose name means “list open files.” (It actually does a whole lot more than this and is so useful that almost every system has it installed. If yours isn’t one of them, you can grab the latest version straight from its author.)

lsof - list open files

fuser - identify processes using files or sockets

In order to look up processes using TCP and UDP sockets, the corresponding name space has to be selected with the -n option. By default fuser will look in both IPv6 and IPv4 sock-ets. To change the default, behavior, use the -4 and -6 options. The socket(s) can be specified by the local and remote port, and the remote address. All fields are optional, but commas in front of missing fields must be present:

[lcl_port][,[rmt_host][,[rmt_port]]]

Either symbolic or numeric values can be used for IP addresses and port numbers.

fuser outputs only the PIDs to stdout, everything else is sent to stderr.

root@dell:~# fuser -nv tcp 25
USER PID ACCESS COMMAND
25/tcp: root 3926 F…. master

FILES

/proc location of the proc file system

EXAMPLES

fuser -km /home kills all processes accessing the file system /home in any way.

if fuser -s /dev/ttyS1; then :; else something; fi invokes something if no other process
is using /dev/ttyS1.

fuser telnet/tcp shows all processes at the (local) TELNET port.

SBDavid

find command numeric arguments

find command numeric arguments

Numeric arguments can be specified as:

+n for greater than n.

-n for less than n.

n for exactly n.

-amin n

File was last accessed n minutes ago.

-anewer file

File was last accessed more recently than file was modified. If file is a symbolic link and the -H option or the -L option is in effect, the access time of the file it points to is always used.

-atime n

File was last accessed n*24 hours ago. When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days ago.

-cmin n

File’s status was last changed n minutes ago.

-cnewer file

File’s status was last changed more recently than file was modified.

-ctime n

File’s status was last changed n*24 hours ago. See the comments for -atime to understand how rounding affects the interpretation of file status change times.

Hardware Requirements for Parallels Virtuozzo Containers

Parallels Virtuozzo Containers for Linux

CPUs: x86, ia64, AMD64, EM64T, Itanium

Memory:
2 GB minimum. More recommended. The required amount depends on the total number of Containers you wish to run on the Node (minimum 50 MB per Container).

Hard disk space:20 GB or more free disk space. The required amount depends on the size of the software to be installed inside Containers.

« Prev - Next »