"How many types of files are there and what are they?" This is a common question to every person who started learing Linux.
Why is this so much important to know file types?
Ans : This is because Linux will consider every thing as files. The Answer to this question is little bit confusing with different answers.
Let me put it in this way to clarify. By default Unix have only 3 types of files..
They are.
1. Regular files
2. Directory files
3. Special files(This is the file type who is the culprit for different answers. This catagory is having 5 sub types.)
So Total file types in Linux are 7. Remeber I am saying in linux there are only 7 types of files but if it comes to unix it is 8 types.
Here are those files. And you can see the file type indication at leftmost part of “ls -l” command
1. Regular file(-)
2. Directory files(d)
Special files
3. Block file(b)
4. Character device file(c)
5. Named pipe file or just a pipe file(p)
6. Symbolic link file(l)
7. Socket file(s)
For your information there is one more file called door files(D) which is present in Sun Solaris. A door is a special file for inter-process communication between a client and server(so total 8 types in Unix machines.).
Regular files : These are the files are indicated with "-" in ls -l output. And these files are.1. Readable files or
2. A binary files or
3. Image files or
4. Compressed files etc.
How to create them?
Ans : Use touch command.
Example listing of regular files :-rw-r--r-- 1 krishna krishna 20986522 2010-01-31 13:48 test.wmv
-rw-r--r-- 1 krishna krishna 173448 2010-01-30 21:20 Transformers-Teaser-Wallpaper-310.jpg
-r-xr-xr-x 1 root root 135168 2009-12-12 19:14 VIDEO_TS.VOB
-rw-r--r-- 1 krishna krishna 2113536 2009-12-01 13:32 Aditya 365 – Janavule.mp3
-rwxrwxrwx 1 root root 168 2010-02-14 14:12 xyz.sh
Directory files : These contains the name and location of files/folders/special files stored on a physical device. And this type of files will be in blue in color.
How to create them?
Ans : Use mkdir command
Example listing of directories.drwxr-xr-x 2 surendra surendra 4096 2010-01-19 18:37 bin
drwxr-xr-x 5 surendra surendra 4096 2010-02-15 18:46 Desktop
drwxr-xr-x 2 surendra surendra 4096 2010-01-18 14:36 Documents
drwxr-xr-x 2 surendra surendra 4096 2010-02-13 17:45 Downloads
Block files : These files are hardware files most are present in /dev
How to create them?
Ans : Use fdisk command or create virtual partition.
Example listing of Block files(for you to see these file, they are located in /dev).
brw-rw---- 1 root disk 8, 1 2010-02-15 09:35 sda1
brw-rw---- 1 root disk 8, 2 2010-02-15 09:35 sda2
brw-rw---- 1 root disk 8, 5 2010-02-15 09:35 sda5
Character devices files : Provide only a serial stream of input or output.
Example listing of character files(located in /dev)
crw-rw-rw- 1 root tty 5, 0 2010-02-15 16:52 tty
crw--w---- 1 root root 4, 0 2010-02-15 09:35 tty0
crw------- 1 root root 4, 1 2010-02-15 09:35 tty1
Pipe files : The other sort of pipe is a “named” pipe, which is sometimes called a FIFO. FIFO stands for “First In, First Out” and refers to the property that the order of bytes going in is the same coming out. The “name” of a named pipe is actually a file name within the file system. --www.linux.com
How to create them?Ans : Use mkfifo command.
Example listing of pipe files
prw-r----- 1 root root 0 2010-02-15 09:35 /dev/.initramfs/usplash_outfifo
prw-r----- 1 root root 0 2010-02-15 09:35 /dev/.initramfs/usplash_fifo
prw------- 1 syslog syslog 0 2010-02-15 15:38 /var/run/rsyslog/kmsg
Sybolic link files : These are linked files to other files.
How to create them?
Ans : use ln command
Example listing of linked files
lrwxrwxrwx 1 root root 24 2010-02-15 09:35 sndstat -> /proc/asound/oss/sndstat
lrwxrwxrwx 1 root root 15 2010-02-15 09:35 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 2010-02-15 09:35 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 2010-02-15 09:35 stdout -> /proc/self/fd/1
Socket files : A socket file is used to pass information between applications for communication purpose
How to create them?
Ans : You can create a socket file using socket() system call avialable under
Example
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
You can refer to this socket file using the sockfd. This is same as the file descriptor, and you can use read(), write() system calls to read and write from the socket.
Example listing of socket files.
srw-rw-rw- 1 root root 0 2010-02-15 09:35 /dev/log
srwxrwxrwx 1 root root 0 2010-02-15 10:07 /var/run/cups/cups.sock
srwxrwxrwx 1 root root 0 2010-02-15 09:35 /var/run/samba/winbindd_privileged/pipe
srwxrwxrwx 1 mysql mysql 0 2010-02-15 09:35 /var/run/mysqld/mysqld.sock
A tip for you guys.
How to find your desired type of a file ?Ans : Use find command with -type option.
For example if you want to find socket file, just use below command.find / -type sIf you want to find linked file then how?Find / -type l
Thats it.. You got it.. :) Enjoy reading..
File Types In Linux
0 comments 2/15/2010 03:22:00 PM Posted by Meghana M BhombhoreLabels: Basics, File System, Tutorials
How to : Confiugre Pidgin To Connect Microsoft OCS/LCS IM Server
2 comments 2/14/2010 10:25:00 PM Posted by Meghana M BhombhoreLabels: Applications, Desktop, Hacks, Pidgin
Note:I am seeing so many people visiting this page, but leaving early.. please feel free to comment at comment section what problems you faced in installing PIDGIN, i am very much interested in helping you..
Good news for all the Linux lovers who are working in Corporate companies where most of the communication is through Microsoft OCS(Office Communicator Software)/IBM Same time IM clients. OCS is primarily used for IM communications, but if you want to use OCS in Linux its not possible till this point. Recently Pidgin started supporting SIP(Session Initiation Protocol) Protocol. So for the people how know about MS OCS. Here is the short notes for you.
MS OCS is a properitery software is an enterprise real-time communications server, providing the infrastructure for enterprise instant messaging, presence, file transfer, Peer to peer and multiparty voice and video calling, ad hoc and structured conferences (audio, video and web) and PSTN connectivity. These features are available within an organization, between organizations, and with external users on the public internet, or standard phones, on the PSTN as well as SIP trunking.
Its little bit tricky to install and use it. Here are the steps how to accomplish this.
Note : By default Pidgin will not support MS OCS. We require a third party (pidgin-sipe) to accesses MS OCS.
Step1 : Check if pidgin is installed or not, From Ubuntu9.10 pidgin is removed as default IM client. So you have to install it.
Installation in Ubuntu :
#apt-get install pidgin
Installing in Redhat/Fedora/CentOS :
#yum install pidgin
Step2 : Install Pidgin-sipe plugin
Installation in Ubuntu :
#apt-get install pidgin-sipe
Installation in Redhat/Fedora/CentOS :
I am not sure if its included in Fedora/Redhat/CentOS repos. If you get error in installing through YUM, install it through source package.
#yum install pidgin-sipe
or
Download source from Soruceforge here.
#mkdir ~/temp
#cd ~/temp
#wget http://sourceforge.net/projects/sipe/files/sipe/pidgin-sipe-1.8.0/pidgin-sipe-1.8.0.tar.gz/download
#tar xvfz pidgin-sipe-1.8.0.tar.gz#cd pidgin-sipe
#./configure;make;make install
Step3 : Most of the time when you install software/packages in Linux you no need to restart the mechine. But this addon/plugin to work you have to restart your machine(its my observation, if its works without restart its good).
Step4 : Configuring Pidgin to support OCS.
Go to Applications
__Internet
__Pidgin instant messanger
__Accounts
__Manage Accounts
__Add


Enjoy using MS OCS in linux.
How To : Linux Terminal Server Project (LTSP)
0 comments 2/13/2010 11:44:00 PM Posted by Meghana M BhombhoreLabels: Guest Post, How-To's, Thin client
Guest post by Sandeep Yadav(http://linuxarea.webs.com/). He is having 2+ years of experience in Linux administration and he is a good at automating system admin task through shell scripting. You can reach him at sandeeprhce5@gmail.com.
Now I will tell you how we can configure LTSP server for our lab with telnet, rdesktop, shell and startx ( for Linux log in).
Step1 :
a. Make sure DHCP server is installed and running properly on your system
b. Now install tftp server also on your machine and you can find it’s rpm on your Redhat DVD (5.0)
c. Now install rdesktop rpm and it is also you can find on your redhat DVD (5.0)
d. Configure your windows xp system with full terminal and remote desktop support for distribute rdesktop also over the network so that client can be run windows xp.
e. Now download ltsp-4.1.0-1_2.iso image from it’s website (http://ltsp.mirrors.tds.net/pub/ltsp/isos/) and my package size is 100MB (apprx.).
f. Now I am making dir test in filesystem (/) and extract this package in test directory
g. Now open readme file from test folder and read instructions carefully on how to install this package.
h. After installation complete you need to configure ltsp server .
Step 2 :
Configure tftp for ltsp server
TFTP : TFTP is a simple file transfer protocol, used by ltsp to transfer the kernel to the workstations.
XINETD : Xinetd is a powerful replacement for inetd, with advanced features, used by ltsp to start tftp.
Open the file # vim /etc/xinetd.d/tftp and make disable = no. Otherwise tftp not work.
service tftp
{
Disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
Now restart xined service
#service xinetd restart
Step3 :
Configure nfs for ltsp server
Open the file #vim /etc/exports and enter following lines in it.
/opt/ltsp 192.168.0.0/255.255.255.0(ro,no_root_squash,sync)
/var/opt/ltsp/swapfiles 192.168.0.0/255.255.255.0(rw,no_root_squash,async)
Now restart nfs service
#service nfs restart
#chkconfig nfs on (for service start automatically on every bootup)
Step4 :
Configure dhcpd.conf for ltsp server
Now you need to configure dhcpd.conf file and here is example of my file.
#vim /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
# option routers 192.168.0.1;
# option subnet-mask 255.255.255.0;
# option nis-domain "domain.org";
option domain-name "san.com";
option domain-name-servers 192.168.0.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
option log-servers 192.168.0.1;
option root-path "192.168.0.1:/opt/ltsp/i386";
If you use thes lines here then every system on your network can boot from #ltsp server but if you want more security then remove this line and then only #that system can boot that’s hardware address will declare in “host ws001” #section with static ip address.
filename "/lts/2.4.26-ltsp-2/pxelinux.0";
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
If you want to use static IP address for your workstation the following section and modify to suit your network. Then, duplicate this section for each workstation that needs a static IP address.
host ws001 {
hardware ethernet 00:20:ED:75:9A:EC;
fixed-address 192.168.0.2;
filename "/lts/2.4.26-ltsp-2/pxelinux.0";
}
}
Step5 :
Configure lts.conf for ltsp server
Now you need to configure #vim /opt/ltsp/i386/etc/lts.conf file for client.
Here is example of my lts.conf file
[Default]
SERVER = 192.168.0.1
RDP_SERVER = 192.168.0.50
XSERVER = auto
X_MOUSE_PROTOCOL = "PS/2"
X_MOUSE_DEVICE = "/dev/psaux"
X_MOUSE_RESOLUTION = 400
X_MOUSE_BUTTONS = 3
USE_XFS = N
X_COLOR_DEPTH = 24 # it is for xp terminal server
X_MODE_0 = 1024x768
RUNLEVEL = 5
LDM_REMOTECMD = /etc/X11/xinit/Xsession
SCREEN_01 = startx
SCREEN_02 = telnet
SCREEN_3 = shell
SCREEN_4 = rdesktop
Note : Here I will explain some options of this file.
SERVER : Here you I have to enter your ltsp server ip address.
RDP_SERVER : If you want to run remote desktop connection on xp then you have enter IP address. Of your xp terminal server. Otherwaise remove this option.
LDM_REMOTECMD :/etc/X11/xinit/Xsession
When I was trying to running startx on client machine it was showing white screen only for solving this problem I copied this. Option from internet and paste it here and my problem solved.
Source : The LTSP client screen will still not display because LTSP expects a file /etc/X11/Xsession to exist on the server. In RHEL5 this corresponds to /etc/X11/xinit/Xsession .This can be fixed by specifying the environment variable LDM_REMOTECMD in /opt/ltsp/i386/etc/lts.conf:[192.168.250.20]LDM_REMOTECMD = /etc/X11/xinit/Xsession.
About SCREEN :
The most interesting parameter here is SCREEN_01. The default is startx, which specifies that the workstation should boot up in a graphical X display, but there are a number of interesting possibilities.
The other options are :
· telnet : When the workstation boots up in this mode, it waits for you to press, then starts a TELNET session to the host. Obviously, your TELNET server must be running for this. (Many offices use SSH by default.). You have to enter your telnet server IP in /opt/ltsp/i386/etc/screen.d/telnet file.
· shell : This starts a local command shell, meaning local to the workstation, not to the server. From here, you could telnet or ssh to your server, or start a graphical login by typing startx. This mode is generally used for testing. It's also a great way to see the virtual Linux machine that gets created as part of the LTSP boot process.
· rdesktop : Setting SCREEN_01 to this fires up rdesktop, a Linux-based Windows Terminal Server Client, which means it uses RDP (remote desktop protocol) to communicate with and run remote Windows sessions from your Linux thin client.
How Many Screen's ?
Ans : Of course, the fact that this last variable is labeled SCREEN_01 leads up to the obvious Question: What about SCREEN_02? Or SCREEN_03?
Earlier in this chapter, I told you about running your main X session on virtual terminal session 7, while the second X session (started with an X -query) ran on virtual terminal 8. You can do something similar with thin-client workstations by modifying the lts.conf file to include more than one SCREEN definition. Here is the example from my own Server :
SCREEN_01 = startx.
You want to enter your telnet server IP in /opt/ltsp/i386/etc/screen.d/telnet file
SCREEN_02 = telnet
SCREEN_03 = shell
SCREEN_04 = rdesktop
The first virtual terminal (accessible by pressing ) runs the graphical login served up via XDMCP. The second virtual terminal () runs a TELNET session with a prompt saying “Screen:2 – Press to establish a connection to the server…” Finally, the third screen () sits at a shell prompt.
In a default LTSP installation, all these screen definitions can be found in the /opt/ltsp/i386/etc/screen.d directory. Each is a shell script and easy to read and understand. You could, if you so wish, create your own screen definitions to better suit your own environment.
These types of screen modifications can be done globally or on a client-by-client basis. In the next chapter, you are going to look at just what sorts of things you can do with workstations. I am also going to show you how you can run a not quite so thin, Linux thin client from a Windows desktop.
Step6 :
Configure xdm-config file for ltsp server
Next, open the file /etc/X11/xdm/xdm-config and comment out the line :
DisplayManager.requestPort: 0
And Edit This file also because sometime it makes problem
/opt/ltsp/i386/etc/xdm/xdm-config and comment out the line :
DisplayManager.requestPort: 0
Step7 :
Enable Remote Login in RedHat so that client able access login screen.
[root@racdb2 ~]# gdmsetup
After starting the gdmsetup utility, click the Remote tab. Under the Remote tab, change the Style pull-down menu selection from 'Remote login disabled' to 'Same as Local' :
After configuring remote access to the GDM login manager, select the Security tab. Under the Security tab,
I have checked the options:
· Allow local system administrator login
· Allow remote system administrator login
Exit from the gdmsetup utility and restart the GDM service :
[root@racdb2 ~]# /usr/sbin/gdm-restart
OR
Enable remote login via configure files.
Use the following steps to enable the services and modify the files necessary to configure the XDMCP:
1. To do this, edit the /etc/X11/xdm/Xaccess file and open the connection to hosts by un-commenting the line:
#* #any host can get a login window
or
Enter individual IP addresses of selected hosts.
SuSE users can do the same by editing the file /usr/X11R6/lib/X11/xdm/Xaccess.
2. Next, open the file /etc/X11/xdm/xdm-config and comment out the line:
DisplayManager.requestPort: 0
And this file also because sometime it makes problem
/opt/ltsp/i386/etc/xdm/xdm-config
3. Make sure to run the program xdm as the "root" user account.
# xdm &
4. If the things still do not work, you may need to reboot the server or restart the xdm if it was already running. The xdm command (X Display Manager) manages a collection of X displays, which may be on the local host or remote servers. The design of the xdm command was guided by the needs of X terminals as well as the X Consortium standard XDMCP (the X Display Manager Control Protocol).
GDM Login Manager
Users running Red Hat Enterprise Linux 5, CentOS 5, or Oracle Enterprise Linux Release 5 will need to use the GDM login manager as XDM is no longer supported.
First, edit the file /etc/gdm/custom.conf and add the following two entries:
[xdmcp]
Enable=true
[security]
DisallowTCP=false
AllowRemoteRoot=true
Next, restart X Windows:
[root@racdb2 ~]# init 3
[root@racdb2 ~]# init 5
Step8 :
It is an optional step because some time client show syslog error after booting it means your server is not configure for accept remote logs so you want to configure some lines for that-
#vim /etc/sysconfig/syslog
and add the -r option as below:
SYSLOGD_OPTIONS=”-r –m 0”
Now restart syslog service
#service syslog restart
And now open file /opt/ltsp/i386/etc/lts.conf and add the following line:
SYSLOG_HOST = 192.168.0.1 #your syslog server ip
More Examples of configure files in different way /etc/dhcpd.conf





