02-06-2013
Creating terminal commands
I've written a program in C, called count_0.1 which is essentially a word count program.
I want to be able to use it as a command in the terminal (by typing in count), like when you type in ls, you don't have to go to a directory, find an executable and type in: ./ls
I've tried:
- Adding the line to .bashrc in my home directory: alias count_0.1='count'
- Putting the count_0.1 file into bin (which made that terminal recognise the command count_0.1, but not count, and if I restarted the terminal, the command no longer worked).
- Creating a bin folder in my home directory and checking that the path is set there in .profile (in my home directory).
Cheers in advance for any light shed on the issue
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi there. Linux newbie and I'm trying to find commands to:
Display number of executable files in a directory that i supply and list them in alphabetical order
Back up all the files in the current irectory to a directory i supply, creating that directory if it's not allready there
Cound... (5 Replies)
Discussion started by: indigoecho
5 Replies
2. Shell Programming and Scripting
Hello,
I used the command
osascript -e 'tell app "Finder" to display dialog "Hey!"'
to display a dialog box..it works fine, it displays a dialog box with 'OK' and 'CANCEL' buttons..i want to get the button returned value how can i do that using terminal command?
is there any command to get... (1 Reply)
Discussion started by: keshav.murthy@r
1 Replies
3. OS X (Apple)
I've seen the executable open in the application OmniOutliner, can I create an executable with this app? I'd like to be able to create the unix executable and insert it into terminal, but I'm not sure if the Omni app will allow me to create it.
Any one have any ideas or possibly familiar with... (10 Replies)
Discussion started by: unimachead
10 Replies
4. OS X (Apple)
Under Leopard, I like to conveniently open Terminal windows onto remote systems. I've created several settings files in Terminal, one for each remote system that I want to access. To open window, I right-click on the Terminal icon in the Dock, expand the "New Window" menu item, and select the... (0 Replies)
Discussion started by: siemsen
0 Replies
5. Shell Programming and Scripting
hi..
I have a small question...if I have a textfile..let say apple.txt and I want to
1. search for all strings that's 6 characters long, and contains the letters a,b,c,d.
2. search for all words that that begins with "sUn" and ends with "flower"
3. search for all the words beginning with the... (3 Replies)
Discussion started by: Oregano
3 Replies
6. UNIX for Dummies Questions & Answers
i am at home with a windows xp home, and i am using putty terminal to access my linux mathlab account, my task is to compile and run a C program, called a.c,
i used
gcc -Wall -g -o mycode a.c
to compile it into a mycode file
now when i want to run it, i was told i had to use
$... (2 Replies)
Discussion started by: omega666
2 Replies
7. Shell Programming and Scripting
Hi,
I am using putty client to connect to my remote Linux server box, and I am connecting through ssh. That system runs bash shell. So, if I use multiple putty terminal, how can I replicate those commands that I ran in other terminals to be available/shared in the current terminal window (i.e)... (1 Reply)
Discussion started by: royalibrahim
1 Replies
8. OS X (Apple)
How do I make terminal autorun commands at start up? For example, I have several windows of terminal, I want one to automatically run 'top' and a couple others autorun 'man' pages.
Is there any way I can do this? (1 Reply)
Discussion started by: randomtypos
1 Replies
9. Programming
Hi
I am trying to modify a C program to work for my needs. Problem is I don't know any real programming. I would really appreciate it if someone could help me!
Basically it is to get bandwidth speeds from a remote box. I have two terminal commands that get me the up and down speeds.
So how do... (8 Replies)
Discussion started by: milestails
8 Replies
10. Shell Programming and Scripting
I frequently use some commands, which I want to save in some file say myregularshell.shthese are the commands I use, I tried saving and executing, but couldn't get the preview of execution, and result is also not coming if I copy same commands and paste it on terminal result is coming
cd go... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies
PTY(4) BSD Kernel Interfaces Manual PTY(4)
NAME
pty -- pseudo terminal driver
SYNOPSIS
pseudo-device pty [count]
DESCRIPTION
The pty driver provides support for a device-pair termed a pseudo terminal. A pseudo terminal is a pair of character devices, a master
device and a slave device. The slave device provides to a process an interface identical to that described in tty(4). However, whereas all
other devices which provide the interface described in tty(4) have a hardware device of some sort behind them, the slave device has, instead,
another process manipulating it through the master half of the pseudo terminal. That is, anything written on the master device is given to
the slave device as input and anything written on the slave device is presented as input on the master device.
In configuring, if an optional count is given in the specification, that number of pseudo terminal pairs are configured; the default count is
32.
The following ioctl(2) calls apply only to pseudo terminals:
TIOCSTOP Stops output to a terminal (e.g. like typing '^S'). Takes no parameter.
TIOCSTART Restarts output (stopped by TIOCSTOP or by typing '^S'). Takes no parameter.
TIOCPKT Enable/disable packet mode. Packet mode is enabled by specifying (by reference) a nonzero parameter and disabled by specifying
(by reference) a zero parameter. When applied to the master side of a pseudo terminal, each subsequent read(2) from the terminal
will return data written on the slave part of the pseudo terminal preceded by a zero byte (symbolically defined as TIOCPKT_DATA),
or a single byte reflecting control status information. In the latter case, the byte is an inclusive-or of zero or more of the
bits:
TIOCPKT_FLUSHREAD whenever the read queue for the terminal is flushed.
TIOCPKT_FLUSHWRITE whenever the write queue for the terminal is flushed.
TIOCPKT_STOP whenever output to the terminal is stopped a la '^S'.
TIOCPKT_START whenever output to the terminal is restarted.
TIOCPKT_DOSTOP whenever t_stopc is '^S' and t_startc is '^Q'.
TIOCPKT_NOSTOP whenever the start and stop characters are not '^S/^Q'.
While this mode is in use, the presence of control status information to be read from the master side may be
detected by a select(2) for exceptional conditions.
This mode is used by rlogin(1) and rlogind(8) to implement a remote-echoed, locally '^S/^Q' flow-controlled
remote login with proper back-flushing of output; it can be used by other similar programs.
TIOCUCNTL Enable/disable a mode that allows a small number of simple user ioctl(2) commands to be passed through the pseudo-terminal, using
a protocol similar to that of TIOCPKT. The TIOCUCNTL and TIOCPKT modes are mutually exclusive. This mode is enabled from the
master side of a pseudo terminal by specifying (by reference) a nonzero parameter and disabled by specifying (by reference) a
zero parameter. Each subsequent read(2) from the master side will return data written on the slave part of the pseudo terminal
preceded by a zero byte, or a single byte reflecting a user control operation on the slave side. A user control command consists
of a special ioctl(2) operation with no data; the command is given as UIOCCMD(n), where n is a number in the range 1-255. The
operation value n will be received as a single byte on the next read(2) from the master side. The ioctl(2) UIOCCMD(0) is a no-op
that may be used to probe for the existence of this facility. As with TIOCPKT mode, command operations may be detected with a
select(2) for exceptional conditions.
TIOCREMOTE A mode for the master half of a pseudo terminal, independent of TIOCPKT. This mode causes input to the pseudo terminal to be
flow controlled and not input edited (regardless of the terminal mode). Each write to the control terminal produces a record
boundary for the process reading the terminal. In normal usage, a write of data is like the data typed as a line on the termi-
nal; a write of 0 bytes is like typing an end-of-file character. TIOCREMOTE can be used when doing remote line editing in a win-
dow manager, or whenever flow controlled input is required.
FILES
/dev/pty[p-sP-S][a-z0-9] master pseudo terminals
/dev/tty[p-sP-S][a-z0-9] slave pseudo terminals
DIAGNOSTICS
None.
HISTORY
The pty driver appeared in 4.2BSD.
4.2 Berkeley Distribution November 30, 1993 4.2 Berkeley Distribution