Unix chapter 2.
2 Typing Unix Commands
As stated, before we are working with a client to server connection. We are sending
protocols through the command prompt or our CLI and specifically using a ssh client program
called the command shell ssb that sends protocols to the ODU UNIX servers over an WAN.
Remember that as a client we must match the protocol to the servers’ services which has its own
protocols that it can receive that are ssh. This ssh clients is sending commands and expects to
receive responses back from this server. Remember that this UNIX server is a computer that has
a special service it provides which is ssh commands and responses. How do we send this in this
class is through our command prompt with ssh on which allows us to send commands, we are
also using a vpn that allows us to see the server in its hidden network and send packets of
information to the server.
The actual ssh client program, get it client because we are the client. This program is special in
some cases because it provides some services for us to streamline how we send commands. One
of them for UNIX server is the tsch. This ssh program has a couple of components such as
directing our commands from the bin directory directly into our path, so we do not need to refer
to it every time we use a command such as
Ls
But the actual command is doing /bin/ls for us.
This automation allows for our execution path to exist automatically.
ech
You can see your execution path by giving the command echo $path.
1 Command Arguments to
Commands have different properties based on the usage of the command given and the
information/program/ and tangible file it is. For example, like copying directories which can’t do
but you can do it to tangible files; however, you can go into directories with the cd command.
They are on a basis-by-basis situation when learning what the commands can do. So, experiment
and try new things.
These are the commands to pay attention to in this section.
The echo command:
The echo command gives out text like “hello world”, its literally an echo. It will print whatever
you want. It can be a string of text or a file directory, such that it will print what is inside of it
Echo string
Echo */sourcepath/file…
In the command line_________________________________________
echo Hello world
Hello world
//This prints out what was stated
The who am I and who command:
These commands give you information on users such as yourself and others on whom have
logged in.
The who command:
The who command will give information on login information for whom has logged in:
In the command line_______________________________________________
cs_npaul004 pts/120 2023-04-18 10:37 (:50)
cs_qlin001 pts/638 2023-04-27 19:55 (:52)
cs_kneig002 pts/763 2023-04-22 20:35 (:54)
cs_mcros008 pts/790 2023-04-23 15:03 (:51)
cs_dwood033 pts/968 2023-04-24 17:22 (:56)
cs_camis001 pts/1082 2023-04-24 15:34 (:60)
cs_kalle055@ganymede:~$
______________________________________________________________________________
The who I am command:
The who I am command, will show information of your logins.
Who I am or who am I commands works the same
In the command line_____________________________________________________________
Who am I
cs_kalle055 pts/1091 2023-06-30 23:58 (10.0.200.
The grep command:
The grep command is a command that allows you to search txt files for specific references to
words think of them as a search command.
Grep string */file/file/[Link]
In the commandline______________________________________________________________
grep string */home/kalle055/playing/ [Link]
//This would reveal all files with a h in the name and the extension txt that have text with the
string
2 Special keys
There are special keys that have certain operations when using them. Those can be space, the
return key, $, and are usually those are some letters with the designation of CTRL(control then
that following letter).
Special keys we know right now.
The arrows up, down which allows for old directories and commands to appear.
The tab auto completes commands. It can also give you all the possible commands as
well.
Enter key executes a command.
As you remember the thing about UNIX and its daughter Linux is its extremely long directories
and commands. For some that is true, but some ways to save some time is by using some quick
short cuts.
Remember TAB, Tab will auto complete commands but also entire directories if you lead it down
the right path, and especially if you have used it before.
Another thing to remember is the up and down arrows which give you already recently used
commands and directories. This can be used to go back in directories or redo specific commands
without needing to re type things entirely.
Up or CTRL P means go backwards in history.
Down or CTRL N means go forward in history.
\
2.2 Special Keys: That Say “I’m Done.”
DCZ
Some of those special characters with letters
1. CTRL D is to cancel out of the program like exit command.
2. CTRL C is to cancel a running program.
3. CTRL Z is to pause a running program.
Copy and Paste
You can copy and paste to and from a ssh session much like you would copy and paste in a word
processor.
Windows (CMD or Powershell)
To copy text in Windows cmd or Powershell windows,
Right-click and drag your mouse across the text to be copied. like this…
1. Copy- You can use keyboard shortcuts to copy and paste* Use hold Ctrl and Insert(INS)
to copy that text to the clipboard.
2. Paste - Use hold Shift and Insert(INS) to paste the clipboard into your command line.
Creating and removing directories and files
As stated previously there tangible files and directories that are containers. While so far we have
been able to manipulate them to a certain capacity we have yet to create any besides the use of
other external commands such as mv. These are the other important commands to pay attention
to.
Rm – remove file
rm allows you to remove tangible files.
rm destination/sourcepath [Link]
add -r for recursive erases file recursively meaning from one point back to another.
Rmdir- Remove directory
rmdir allows you to remove directories.
rmdir sourcepath/destinationpath [Link]