Unix Commands
Unix Commands
unix commands
UNIX COMMANDS
UNIX COMMANDS.............................................................................................. 2
Basic commands of the vi (edito di Unix)...............................................................................2
Creating a boot disk for XNC................................................................................................... 3
Using the Boot disk................................................................................................................. 4
Unix file properties.................................................................................................................. 4
Copy to disk............................................................................................................................ 5
Linked files.............................................................................................................................. 5
Finding a file inside the machine backup disks.......................................................................6
Copy and check disk commands <cpdisk - verarc>...............................................................6
Commands for shifting a file from Unix--->Dos......................................................................7
Creating zipped files (.tgz)...................................................................................................... 7
Creating machine backup files................................................................................................8
Creating the disk d_xnc (doc in Italian/English)......................................................................8
Istruction fsck for “cleaning” the file systems........................................................................8
Command to search a file in xnc............................................................................................ 8
Removing the random magazine from the graphics...............................................................8
Istructions for screen saver timer...........................................................................................9
Changing the time on XNC.................................................................................................... 10
Entering X-terminal............................................................................................................... 10
If the NC locks at the start up giving the message File or directory doesn’t exist................10
Length of the XNC program names.......................................................................................10
Display card status............................................................................................................... 10
Checking if the Compiled PLC exists (previous version 1.2.0.0)..........................................11
Disk copy and check commands <cpdisk - verarc>.............................................................11
2
unix commands
UNIX COMMANDS
cd [pathname] changes the working directory
ls [opzioni] [dir] displays the content of a directory with the following options:
-a hidden files are displayed too
-l for each file is displayed information such as: the type (file “-”,
directory “d”), the permissions and the owner.
-F displays names of files marked with * if they are executable files,
with / if they are directories, or with @ if they are links to other files.
ps -ax displays the list of running processes with the following information:
PID (identification number) of the process, number of the terminal on
which the process is launched, process status, time of CPU use and command name
associated to the process.
kill [Process PID] ends the execution of the process specified by the PID number.
mv file1 file2 changes a file name file1 in file2; if file2 already exists, it is deleted.
tar [opzioni] file allows copying files from/to UNIX floppy disks. The options are:
cv to copy a file from hard disk to floppy
xv to copy a file from floppy to hard disk
tv to display the content of the floppy.
dosread [opzioni] /dev/fd0 file DOS > file UNIX allows copying a file from DOS floppy to
hard disk. Use option -a if the file is a text file.
doswrite [opzioni] /dev/fd0 file DOS < file UNIX allows copying a file from the hard disk to
the DOS floppy. The same rule of dosread for option –a applies
su (Enter)
cp /{preboot, lynx.os,init} . copies the three files into the current directory
mnt
cd /tmp
cd /tmp
cd /etc
cd /mnt/dev
4
unix commands
cd /mnt
cd /
The boot disk is used when the control does not start regularly due to system errors or
because some functions of the system have been deleted or tampered.
Use procedure:
Insert the Boot disk and start the control; once loaded, the terminal will display the
following message:
bash#
run the commands in the following sequence:
fsck /dev/hd0a (in case of errors, use the same command until they disappear)
fsck /dev/hd0b
mount /dev/hd0a /mnt
PATH=/mnt/bin
Now, the commands contained in the directory bin of the hd are available.
Ex: ls (directory content) rm (remove file) etc.
TERM=vt100
You can change the file owner with the command chown, but only the owner or the super
user can do it:
on
chown (new owner) (file name)
You can also change the properties of the file with the command chmode :
on
chmod 731 (file name)
7 sets all three 3 bits of the owner
3 sets the first and second bit of the group
1 sets the first bit of the others
or:
on
chmod (u)(g)(o)+(r)(w)(x)
the first letter shows where to change, + to add and – to remove, the second letter shows
what to change.
The command whoami shows who I am at the moment:
type
whoami
Unix answers
root
Copy to disk
The command tar allows carrying out operations on the floppy
- tar cv (file name) from H.D. to floppy. All that was on the floppy is deleted.
- tar rv (file name) the files are added to the floppy, and the old content of the
floppy is maintained.
- tar xv (file name) from floppy to H.D. , all the floppy is copied if no file is
specified.
The command gnutar allows executing operations on the floppy with zipped
files.
- gnutar -ztvf (file name) shows the content of a zipped file on the H.D.
- gnutar -zPxtvf (archive name) (list of files to extract from the archive)
extract and unzips the files required from the zipped file,
and installs them in the origin paths.
The command cat allows copying a floppy to another floppy. You must first copy
the floppy to HD.
- cat /dev/fd0 > (file name) copies the floppy content to the HD saves it as file.
Linked files
With Unix you can link the files, that is to say, or can refer to a pointer file which takes up
few bytes, which launches the actual file:
The command to link the files is :
ln -s (name of the file to point) (name of pointer file)
6
unix commands
Example of extraction of the 2 files making up the PLC from the backup and their automatic
positioning in the correct directories of the hard disk :
gnutar^xOMf^/dev/fd0^|^gnutar^-zxPvf^-^/home/xnc/bin/isaker^
/home/xnc/bin/plc-objs/prog.oo
where:
/home/xnc/bin is the path of the first file to be extracted
/isaker is the name of the first file to be extracted
/home/xnc/bin/plc-objs is the path of the second file to be extracted
/prog.oo is the name of the second program to be extracted
insert the 4 disks (volume 1 2 3 4)
find^/^-name^nomefile^-print (^=space)
With the updating disks, there is another disk with the files CPDISK and VERARC.
use these files to
copy disks
check disks
You have to first install the files to the hard disk as follows:
enter X-terminal
type SU (superuser) and press Enter
insert disk CPDISK - VERARC
type INS and press Enter and follow the instructions of the NC.
Once the installation is complete, you can use these files every time you must do a copy of
a disk (non-UNIX disks also):
just type SU Enter, CPDISK enter and follow the instructions of the NC.
with the file VERARC (check archive) you can check the integrity of the disk.
7
unix commands
Check that there are no strange errors or messages, but only the names of copied files.
NOTE:
You can also use DOS commands
Mread “A:\*.*” .
(the full stop means you want to maintain the same name)
open X-terminal
type su
type vi files.aux
a unix file will be opened, in which you must indicate what files must be zipped into .tgz
type for example \home\d_xnc to zip the directory d_xnc
save the file with :x
type gendsk (creates the file and puts it into the current directory of the hard disk)
at the end, you will be asked if you want a copy of the file of the disk.
NOTE:
When unzipping, a TGZ disk will download the files in the same directories in which they
have been zipped. If these directories do not exist anymore, it will create them
automatically.
8
unix commands
The NC will now create a disk “D_XNC” of the same type as that supplied with the machine,
but updated with the new data.
The files of the disk thus created, unlike the disk supplied with the machine, can be easily
found from the environment DISK MANAGER.
The command fsck^/dev/hd0a controls the file system and removes temporary files.
The command operates using the directory lost+found located in the main directory (type
cd / to reach it) .
Attention:
This command is automatically launched whenever the machine is started up, but should
the directory loast+found be missing, the command may be never executed, thus locking
the system (after some time, any writing on the hard disk is impossible, giving the error
device is full). In this case, try deleting some files and type the command again.
You can search a file among the directories located on the XNC with the following
command:
If the icon of the RANDOM magazine is displayed, you just have to enter the machine data,
magazine, and delete all the lines of magazine that are not actually used.
If in the machine data there are only the lines actually used for the magazines, the random
icon will disappear automatically.
9
unix commands
Istructions for screen saver timer
(Maybe you already have the line <<xset s off>>; so you have to check whether there is
another line where is written:
Prio -4 Xmiss -initial 100 -bt150 -module dim &
You can change the delay value 150 to 300 (that means a delay of 300 seconds=5minutes)
1
unix commands 0
type ---> su
type ---> date[spazio]9702201151.00
Entering X-terminal
If you cannot enter X-terminal through the usual procedure, you can enter as follows:
If the NC says that the file or directory /etc/utmp doesn’t exist, the client may have ruined
the file Xconfig entering from X-terminal with the command configX. When the machine
starts up, after the checksum the message FILE OR DIRECTORY DOESN’T EXIST is displayed.
To solve the problem, enter with Ctrl C and root (alt F2)
enter the dir typing cd /usr/lib/X11/Metro
in this dir there should be the files Xconfig.compatto e Xconfig; the latter ir damaged.
Then, you must copy the file Xconfig.compatto to Xconfig typing cp Xconfig.compatto
Xconfig
then, make a reboot -ah
The names of the XNC programs must be of 8 characters max. so as to prevent any
problems while transferring with the diskmanager and uploading by Optix.
The information to be set to restrict the (new) names to 8 characters is currently located in
the FLAG table of user tables, visible at password level No.16. The name of this information
is DOS FILE: if =1 the restriction is enabled.
With the version 1200 this information is available at a password level No.15 (OEMPWD), so
as to give the possibility of agreeing with the client the name restriction to all external
users. Usually it is set to 1.
With the next version 1202 this information will be available at a password level No.10
(SERBS).
cat /dev/klog
At the execution of the command, the cards recognised by the control and those not
recognised are displayed.
1
unix commands 1
c:/home/xnc/bin/plc-objs/
The other part of the PLC is named isaker and is located in the directory /home/xnc/bin/
Together with the update disks, there is another disk containing files CPDISK and VERARC.
these files are for
copying disks
checking disks
You must first install the files to the hard disk as follows:
enter X-TERMINAL
type SU (superuser) and press Enter
insert disk CPDISK - VERARC
type INS and press Enter and follow the instructions of the NC.
Once the installation is finished, you can use these files any time you must do a copy of a
disk (also non UNIX):
you just have to type SU Enter, CPDISK Enter and follow the instructions of the NC.
with the file VERARC (archive check) you can check the disk integrity. You must make sure
that there are no strange errors or messages, but only the names of the files copied.