User:Idisestablish/sandbox

Command Line Interface
As stated previously, many Linux systems are not designed with a graphical user interface (GUI) but instead use a command line interface (CLI). You may be familiar with well-known CLIs such as Windows-predecessor MS-DOS or Windows' Command Prompt. In Linux, the CLI is often referred to as a terminal or console.

Using a program like PuTTY, you can remotely control the cluster by typing in specific commands. A screenshot of a PuTTY instance logged in to KnightRider is shown below. To send a command, simply type the command and press Enter or Return.

See also: List of Commonly Used Linux Commands.

Root Directory
Like most other operating systems, the Linux filesystem is composed of a hierarchical system of files and folders. While in Windows, the first or top-most directory in the filesystem is denoted by the drive letter followed by a colon and backslash (e.g. C:\), in Linux the top directory is known as the root directory and is simply represented by a forward slash (/).

Working Directory
One key concept to understand when using Linux is the working directory. Essentially, the working directory is the folder in the file system that the user is currently "in." You can determine your current working directory by using the pwd command. By default, your working directory will be your home directory /home/username upon logging in to the system.

Commands issued on a specific file or folder must specify the location of the file or folder. This is accomplished either by using the absolute location starting with the root directory or using the relative location, which is the path of the file relative to your working directory. In other words, if you want to delete a file located in your home directory, and your working directory is your home directory, you can enter either: rm myFile1.txt or rm /home/username/myFile1.txt Since there is no forward slash (root) at the beginning of the filepath in the first example, it is interpreted as being a file located in the working directory.

A file or directory does not need to be in the working directory in order to use the relative location from the working directory. For example: rm ../myFile1.txt This will look for a file in the parent directory (the directory the working directory is contained within) to delete called myFile1.txt. When changing directory or specifying a relative path, two periods (..) represent one step up in the filesystem hierarchy. Conversely, you can also specify a path down the filesystem. rm MyFolder/myFile1.txt This command will look in the working directory for a child directory named MyFolder and within that directory for the file named myFile1.txt to delete.

Getting Help
The man command is a useful tool for getting additional help with a command. For example, if you are looking for help with the chmod command you can simply enter: man chmod After entering this command, detailed documentation on the chmod command will be printed to the console.

Application Tutorials
Filezilla - Used to transfer files (FTP) between client and server.

PuTTY - Used to establish SSH connection between client and server.

CLASS Traincar DEFINITION. PUBLIC SECTION. DATA: idNumber TYPE string READ-ONLY, yearBought TYPE i READ-ONLY, color TYPE string READ-ONLY, weight TYPE i READ-ONLY, numCars TYPE i READ-ONLY.

METHODS constructor IMPORTING idNumber TYPE string DEFAULT '0000' yearBought TYPE i DEFAULT '0000' color TYPE string DEFAULT 'No color' weight TYPE i DEFAULT '0' numCars TYPE i DEFAULT '0'.

METHODS showCar.

METHODS getWeight RETURNING VALUE(weight) TYPE i.

ENDCLASS.

CLASS Traincar IMPLEMENTATION. METHOD constructor. me->idNumber = idNumber. me->yearBought = yearBought. me->color = color. me->weight = weight. me->numCars = numCars. ENDMETHOD.

METHOD showCar. WRITE: / 'ID: ', 20(*) idNumber, / 'Year: ', 20(*) yearBought, / 'Color: ', 20(*) color, / 'Weight: ', 20(*) weight, / 'Number of Cars: ', 20(*) numCars. ENDMETHOD.

METHOD getWeight. weight = weight. ENDMETHOD. ENDCLASS.

CLASS PassengerCar DEFINITION INHERITING FROM Traincar. PUBLIC SECTION. DATA: numSeatsAvailable TYPE i READ-ONLY, numSeatsFilled TYPE i READ-ONLY, airConditioned TYPE string READ-ONLY, bathroom TYPE string READ-ONLY.

METHODS constructor IMPORTING idNumber TYPE string DEFAULT '0000' yearBought TYPE i DEFAULT '0000' color TYPE string DEFAULT 'No color' weight TYPE i DEFAULT '0' numCars TYPE i DEFAULT '0' numSeatsAvailable TYPE i DEFAULT '0' numSeatsFilled TYPE i DEFAULT '0' airConditioned TYPE string DEFAULT 'N'               bathroom TYPE string DEFAULT 'N'.

METHODS showCar REDEFINITION.

METHODS getWeight REDEFINITION.

ENDCLASS.

CLASS PassengerCar IMPLEMENTATION. METHOD constructor. super->constructor( idNumber = idNumber yearBought = yearBought weight = weight color = color numCars = numCars ). me->numSeatsAvailable = numSeatsAvailable. me->numSeatsFilled = numSeatsFilled. me->airConditioned = airConditioned. me->bathroom = bathroom. ENDMETHOD.

METHOD showCar. super->showCar. WRITE: / 'Seats Available: ', 20(*) numSeatsAvailable, / 'Seats: Filled: ', 20(*) numSeatsFilled, / 'Air Conditioned: ', 20(*) airConditioned, / 'Bathroom: ', 20(*) bathroom. ENDMETHOD.

METHOD getWeight. weight = me->weight + ( numSeatsFilled * 200 ). ENDMETHOD.

ENDCLASS.

CLASS TankerCar DEFINITION INHERITING FROM Traincar. PUBLIC SECTION. DATA: fuelCapacity TYPE i READ-ONLY, fuelWeight TYPE i READ-ONLY.

METHODS constructor IMPORTING idNumber TYPE string DEFAULT '0000' yearBought TYPE i DEFAULT '0000' color TYPE string DEFAULT 'No color' weight TYPE i DEFAULT '0' numCars TYPE i DEFAULT '0' fuelCapacity TYPE i DEFAULT '0' fuelWeight TYPE f DEFAULT '0.00'.

METHODS showCar REDEFINITION.

METHODS getWeight REDEFINITION.

ENDCLASS.

CLASS TankerCar IMPLEMENTATION. METHOD constructor. super->constructor( idNumber = idNumber yearBought = yearBought weight = weight color = color numCars = numCars ). me->fuelCapacity = fuelCapacity. me->fuelWeight = fuelWeight. ENDMETHOD.

METHOD showCar. super->showCar. WRITE: / 'Fuel Capacity: ', 20(*) fuelCapacity, / 'Fuel Weight: ', 20(*) fuelWeight. ENDMETHOD.

METHOD getWeight. weight = me->weight + fuelWeight. ENDMETHOD.

ENDCLASS.

START-OF-SELECTION.

DATA iTab TYPE STANDARD TABLE OF REF TO Traincar. DATA wa LIKE LINE OF iTab.

DATA train TYPE REF TO Traincar. CREATE OBJECT train. APPEND train TO iTab. WRITE 10 'TRAIN'. train->showCar. WRITE: / 'Weight: ', 20(*) train->getWeight. ULINE.

WRITE 10 'PASSENGER'. DATA passenger TYPE REF TO PassengerCar. CREATE OBJECT passenger. APPEND passenger TO iTab. passenger->showCar. WRITE: / 'Weight: ', 20(*) passenger->getWeight. ULINE.

WRITE 10 'PASSENGER2'. DATA passenger2 TYPE REF TO PassengerCar. CREATE OBJECT passenger2 EXPORTING idNumber = '1111' yearBought = '1980' color = 'Black' numCars = '100' weight = '1000' numSeatsAvailable = '20' numSeatsFilled = '10' airConditioned = 'Y'           bathroom = 'Y'. APPEND passenger2 TO iTab. passenger2->showCar. WRITE: / 'Weight: ', 20(*) passenger2->getWeight. ULINE.

WRITE 10 'TANKER'. DATA tanker TYPE REF TO TankerCar. CREATE OBJECT tanker. APPEND tanker TO iTab. tanker->showCar. WRITE: / 'Weight: ', 20(*) tanker->getWeight. ULINE.

WRITE 10 'TANKER2'. DATA tanker2 TYPE REF TO TankerCar. CREATE OBJECT tanker2 EXPORTING idNumber = '2222' yearBought = '1960' color = 'Silver' numCars = '100' weight = '2000' fuelCapacity = '2000' fuelWeight = '3000'. tanker2->showCar. APPEND tanker2 TO iTab. WRITE: / 'Weight: ', 20(*) tanker2->getWeight. ULINE.

WRITE 10 'POLYMORPHISM'. LOOP AT iTab INTO wa. ULINE. wa->showCar. ENDLOOP.