Frequently Asked Questions - Unix-Linux



Connecting to cse.unl.edu and other unix servers with ssh from Linux

Open a Terminal window.  The instructions that follow are for Ubuntu Linux.  Other distributions are similar.

Click on the grid button in the lower left corner.

ubuntu search icon

Enter "Terminal" in the search dialog that appears.

ubuntu terminal command search window view

In the window that appears when you click on the Terminal icon shown above, enter "ssh -Y username@cse.unl.edu".  Substitue your cse user name for "username" in this command.  You can omit the "-Y" flag if you do not want to use ssh X forwarding (and if you don't know what this is, you can safely omit it).  The examples below use a user name of "sac".

ubuntu terminal secure shell connection initial system connection prompt

The first time that you connect to cse.unl.edu, or any other Linux/Unix server, a dialog like that shown above will appear.  Answer "yes" to this.

Then enter your cse password.

ubuntu terminal window showing successful secure shell connection to remote host

Back to top ↑



How to reset your MySQL password on cse.unl.edu

Resetting MySQL Password 

If you have forgotten your MySQL password, reset your MySQL password by going to https://cse.unl.edu/account. Log in using your School of Computing (SoC) credentials and click the 'Reset MySQL Password' link. A new randomly generated password will be sent to you via email.

Changing MySQL Password from the MySQL CLI

If you know your old MySQL password, the password can be changed from MySQL workbench or from the MySQL command line interface (CLI). To chance your password from the CLI, connect to cse.unl.edu, run the MySQL client, once connected, enter the following command at the MySQL client prompt: 'set password=password('####');' and hit enter. Where '####' denotes the password you wish.

Back to top ↑



Connecting to the Windows Terminal Server from Linux

The instructions that follow are for Ubuntu Linux. Other Linux distributions are similar except for installing the "Remmina" program.

Click on the grid icon at the lower left of the screen.

ubuntu search icon

In the search dialog that appears enter "rdp".  The Remmina application should appear in the results. Click on that icon.

ubuntu search window for Remmina application

In order to connect to our terminal server you need to add a customized connection.  Click on the green "+" symbol in the Remmina program and enter the following information:

Profile name: csnt-ts (or another name that you'd like to use).

Server: csnt-ts.unl.edu

User password: your CSE password

Domain: cs.unl.edu

Color depth: True color (24 bpp)

And then click the "Save" or "Save as Default" button.

Remote desktop settings window of Remmina application

Double click on the session you just saved.

Remmina session view

A dialog may appear asking you to accept a certificate for csnt-ts. You should accept the certificate.

Remmina certificate acceptance window

Back to top ↑



Accessing School of Computing systems using NoMachine - Remote X11 GUI access

NoMachine is a fast, multi protocol remote access client which allows RDP and X11 type connections to a variety of servers. We have a NX server installed on two servers; cse-linux-01.unl.edu and cse.unl.edu, which allows GUI X11 Desktop access to either of these systems. Below are steps on setting up a noMachine connection to cse-linux-01.unl.edu.

You can download and install NoMachine from https://www.nomachine.com/ 

To configure a new connection, after you launch noMachine: 

  1. from the Recent connections pane,  click on ‘New’ 
  2. for Protocol select NX 
  3. In the Host input enter ‘cse-linux-01.unl.edu’
  4. for Authentication method select Password
  5. select the Don’t use proxy radio button.
  6. Name your connection and finally click on Done

Once you have configured a connection to establish a connection:

  1. from the Recent connections pane,  double click on the named connection
  2. Enter your MyRed login credentials for the cse-linux-01.unl.edu server (username and password)
  3. Double click on the Create a new virtual desktop  icon new virtual machine
  4. Click thru the next four dialogs that provide you an overview on using noMachine

For connection to the legacy cse.unl.edu server you must use a CSE login and password, which is separate and distinct from your MyRed login and is only used to connect to SoC legacy servers and web applications. You will not need a CSE login unless an instructor or faculty member has told you that you need one to access legacy research or instructional tools and/or data.

Tip: You can save your password, the connection type, and click on Don’t show this message again on the dialogs for one-click connection to cse.unl.edu

Note: Please log off when you are done working on cse.unl.edu. Simply disconnecting the NoMachine client will consume resources on the server and your session will be forcefully quit at somepoint, possibly resulting in loss of any unsaved data or settings.

Back to top ↑



Linux SMB Printing

The example provided depicts the GUI interface provided by the Ubuntu Linux 20.04 LTS distribution. Note: Printing only works when you connected to a University of Nebraska network.

Prior to setting up printing, you need to install some prerequisite programs.  This can be done with the shell-prompt command "sudo apt install psutils python3-smbc smbclient" there will likely be a number of dependencies that also need to be installed when you issue this command.

  1. Open System Settings by clicking on the icons in the upper right corner and select "Settings".
    settings icon location
  2. Select Printers on the left and then click "Additional Printer Settings..."
    additional printer settings location
  3. Click on Add:
    add printer icon
  4. Select "Windows Printer via SAMBA"  Enter csnt/ and the name of the printer that you want to add such as "Avery-ps15" and select "Set authentication details now" if the option is presented. For your login credentials, you should use your CSE login username inserting cs.unl.edu\ before your CSE username, e.g. cs.unl.edu\username. Complete the administration of the printer by entering your password and click Forward:
    credentials entry example
  5. Select Generic and click Forward on the next window:
    selecting generic on driver choice menu
  6. Select PostScript in the Drivers column of the next window and select Generic PostScript Printer Foomatic/Postscript [en] (Recommended) column and then click Forward:
    selecting postscript foomatic menu item
  7. Enter a short name for the printer, such as "ps15", and a "Human-readable" name for the printer such as "Avery-ps15" and then click Apply. The short name can be used later for command-line printing and the "Human-readable" name will show up in print applications that use the system's GUI.
    entering a name for a new printer
  8. You can click Cancel on the popup window or click Print Test Page. The test page will be deducted from your print quota if you choose to print it.
    test page menu page
  9. If everything worked as expected you should see the printer.
    system printer menu showing new printer

If you encounter the error: CUPS server error "client-error-not-possible" or a similar error from the CUPS subsystem, you will need to install the smbclient package, and perhaps additionally the samba or smb-common package, using the package manager provided with your Linux distribution.

Linux Mint uses very much the same procedure except instead of being called "System Settings" the system configuration application is called "Control Center". Other Linux distributions are similar.

If you want to take advantage of more advanced printer features, such as duplexing or stapling, you can use a printer-specific driver for the printer models as seen at the bottom of Printing from Mac via SMB 10.8+ section of this FAQ

Back to top ↑



VMware Installation using D2L Brightspace

VMware Installation

Local Virtual Machines in the School of Computing (SoC) are generally run under VMware Fusion or Workstation. This and other VMware products are available to SoC students through VMware's Academy Software Licensing program (which is hosted by D2L Brightspace). This service replaces our previous subscription service to VMware OnTheHub.

Downloading VMware Products

Start by requesting a subscription to the VMware Academy Software Licensing Program via the SoC account management portal as outlined below.

  1. Visit https://cse.unl.edu/account.
  2. Login with your cse.unl.edu credentials.
  3. Click on the Account Settings link.
  4. Check the "VMware Academic Software Program (D2L Brightspace)" checkbox and save your settings.

This will initiate an account request using your huskers.unl.edu email address. You should receive an email with a link by the next business day. Once you receive the email, click on the link provided for download access.

vmware access account request granted email example

The link leads to a following page. Click on the 'Click here' button to proceed.

vmware login page view

If you already have a D2L account, click on Log In, otherwise click on the Register button.

login or register on site

Complete your registration if you clicked on the Register button above, otherwise skip this step.

vmware registration view

On the next page, select the "Click Here to Redeem" button.

vmware redeem permission code for license


Click on the "Software Products and License Keys" button presented on the next page.

license key issuance

The left column of the screen shows the steps to request the VMware software and obtain the 1-Year License Key. The right column contains the download links for your software. VM Workstation is for PC's and VMware Fusion is for MAC.

At this point, you will install the downloaded VMware client and apply the license.

Notes:

  • Product licenses issued through the VMware Academic Program are valid for one year from date of issue.
  • Access to VMware Academic Program subscription (D2L) site are reset every October.

– In effect, if your VMware product license has expired, you will need to re-request a subscription to the VMware Academic Software Licensing program by following the instructions on this FAQ Section: Downloading VMware Products, in order to access new versions of VMware products or licenses.

Back to top ↑



Code development on the SoC Linux servers with Visual Studio Code

If you are developing C or C++ code on the School of Computing's CSE server (cse.unl.edu) and using a Windows PC or Mac, you may benefit from using Visual Studio Code (https://code.visualstudio.com/docs/setup/windows (Links to an external site.)) as an editor. While not as full-featured as a true IDE, VS Code does give you syntax and code error highlighting which can be beneficial.

To use Visual Studio Code to edit your files stored on the CSE server, you will need to attach (mount) your CSE home directory as a remote drive. The instructions on the How do I access my home directory on campus? page will tell you how to mount your home directory as the Z: drive on a Windows system. A similar procedure for Mac allows mounting your home directory using Mac OS.

After mounting your CSE home directory, you can open Visual Studio Code to Explore your Z: drive, and open a workspace. Project directories located in your CSE home directory or subdirectories can be selected using the VS Code Explore tool. Selecting the Open Folder link in VS Code also opens the Explorer tool.

VS Code Explore panel showing Z: drive
Figure 1. VS Code - Explorer tool view showing a mounted CSE home directory

You can use Windows Explorer to copy or move source and/or project files and directories from your local laptop hard drive into your Z: drive, and create any directories or sub-directories in your CSE home directory. If you are using Git to store your project, you can clone it directly into your Z: drive by selecting the directory on the Z: drive where you want to clone the project.

To Clone a Git repository project using VS Code, choose the Clone Repository button:

example of a cloning a git repository via the interface
Figure 2. VS Code selecting a Github project repository to clone

Choose a directory on Z: drive to save the git project:

specifying the directory as the remote mount Z: drive
Figure 3. Selecting a directory on the CSE server using the mounted Z: to save the Github project repository into

This example clones a project from Github, and saves the project within the directory ~/git on the CSE server. The tilde character, ~ refers to your home directory on CSE, and the git directory is an arbitrary directory that I have chosen to save all my git projects.

For MacOS, after following the instructions to mount your CSE home directory, you can use the Mac Finder application to navigate into your CSE home directory (remote location) and copy files and directories to and from your MacOS machine. Opening files and projects in VS Code is the same in MacOS using the VS Code Explorer tool, including the cloning repositories by selecting your CSE home directory remote location.

Attaching to your CSE home directory on from an off-campus network may require using a VPN connection. The VPN is a service of UNL Information Technology Services, visit the UNL ITS Global Protect VPN page for instructions on installing and connecting to the UNL network using the VPN client.

Disk Usage Considerations

The prior version of this article instructed users to load the Remote - SSH extension into VS Code and connect to the CSE server via that extension when running VS Code. The instructions above supersede those, and make the need for a .vscode-server directory in your home directory unnecessary.
If you have used VS Code using the old instructions, you may reach or exceed your quota of disk space on CSE. Using the Remote - SSH extension triggers the installation of a 100MB+ image of the VS Code Server into your home directory. With prolonged use of VS Code and Remote - SSH, you may have multiple copies of the VS Code Server application being placed in a subdirectory of your home directory. This is caused by VS Code and the update mechanism, resulting in extra copies of the executable files in ~/.vscode-server/bin. These old/extra copies count against your disk quota on the CSE server, and may result in you receiving disk quota exceeded emails from CSE Systems Support. These old/extra copies can safely be removed, an easy way to tell is if the date reported by ls -lt is the most recent, that is the copy to keep. All older copies can be safely removed.

Below is an example of what you will find in the VS Code Server directory, ~/.vscode-server and how to remove extra copies of VS Code executable files:

wmotycka@cse:~> ls -l ~/.vscode-server/bin/
total 12
drwxr-xr-x 6 wmotycka staff 4096 Oct 26 07:54 d2e414d9e4239a252d1ab117bd7067f125afd80a  # NOTE OLDEST DATE
drwxr-xr-x 6 wmotycka staff 4096 Jan 16 08:55 ea3859d4ba2f3e577a159bc91e3074c5d85c0523
drwxr-xr-x 6 wmotycka staff 4096 Nov  8 09:00 fcac248b077b55bae4ba5bab613fd6e9156c2f0c    # NOTE OLD DATE
wmotycka@cse:~> cd ~/.vscode-server/bin
wmotycka@cse:~/.vscode-server/bin> du -hs
317M    .
wmotycka@cse:~/.vscode-server/bin> du -hd1
112M    ./d2e414d9e4239a252d1ab117bd7067f125afd80a
104M    ./ea3859d4ba2f3e577a159bc91e3074c5d85c0523
103M    ./fcac248b077b55bae4ba5bab613fd6e9156c2f0c
317M    .
wmotycka@cse:~/.vscode-server/bin> cd ../..
wmotycka@cse:~> # Remove the extra/oldest copy/copies of the VS Code Server using 'rm -rf'
wmotycka@cse:~> rm -rf ~/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a
wmotycka@cse:~> rm -rf ~/.vscode-server/bin/fcac248b077b55bae4ba5bab613fd6e9156c2f0c
wmotycka@cse:~>

The last two commands above remove the oldest copies of VS Code Server images while retaining the most recently dated copy present.

Latest Notes

Unless you have a particular need, we recommend completely removing the ~/.vscode-server directory and instead access files on CSE using the method above. The ~/.vscode-server directory is necessary for operation using the Remote - SSH extension but is unnecessary when using VS Code on remote-mounting files to your personal Windows or Mac machine. There is also a performance improvement to VS Code by using remote-mounted files instead of the Remote - SSH method since all of the editing work is done on your local system. Disk usage reduction and performance improvement together justify changing to the method described above. If you want, remove all the contents of the ~/.vscode-server/bin/* and then use the instructions above to connect to your project. The only change you should see may be the need to install extensions locally that you originally had installed on the CSE server.

The Remote - SSH extension can also cause performance issues on the CSE server. Features of the extension like file search spawn processes that can linger in the CSE process table, becoming "zombie" processes that can only be removed by manual intervention (reboot or using 'kill' on each.) These lingering processes reduce available processing time, which you experience as slow compiles and program execution.

VS Code on a Linux client

Running VS Code on a Linux client (for example running Ubuntu on your own laptop) the way you mount the drive is important. You will need to use the fuse filesystem and the base SAMBA client packages samba-client and samba-common. For more specifics follow (or search) the instructions for your Linux distribution regarding installing SAMBA client. For my installation (Kubuntu 22.04), I also installed samba-common-bin, samba-libs, samba-vfs-libs, smbclient, cifs-utils, and winbind packages.
The Gnome Virtual Filesystem gvfs facility, if properly configured, will mount your CSE home directory to one of the two the default locations, ~/.gvfs or /run/user/<user-number>/gvfs. This gvfs facility is easy to use from the Gnome Files application, but doesn't work properly with all file managers like Dolphin, where the mounted CSE filesystem is not being exposed into the ~/.gvfs or /run/user/<user-number>/gvfs directory, as the gvfsd-fuse documentation describes. Using the Gnome Files application, the /run/user/<user-number>/gvfs directory contains the mount point directory that allows access to your CSE home directory. Later instructions provide the Linux shell command-line necessary to mount your home directory without the use of a file manager application.
After installing the appropriate packages, the following steps will mount your CSE home directory:

  • Launch the Files application, and select Other Locations from the left-side menu:
    Gnome Files application view of other locations
    Figure 4. Gnome Files application Other Locations page
    In the Connect to Server field enter the URL for connecting to the the Samba server, smb://cse-smb1.unl.edu/%lt;cse-login%gt; where cse-login is your username on the CSE server. Finish this step by pressing the Connect button.
  • You will next be prompted to enter your CSE username (login id), network domain, and password. Enter cs.unl.edu for the Domain, and your CSE username and password:
    CSE credentials prompt
    Figure 5. Network connection prompt for CSE login credentials
  • Your CSE home directory is now mounted and can be accessed from within VS Code using the Explore Open Folder action:
    CSE home folder in Explorer view
    Figure 6. VS Code Explore panel offering your CSE home directory under the Networks heading

You can also mount your CSE home directory using the Linux command-line shell. The following outlines the basic steps:

  • Open a terminal window and execute the command: gio mount smb://cse-smb1.unl.edu/cse-login replacing cse-login with your login id on the CSE server
  • You will be prompted for you CSE login id and credentials:
    CSE credentials prompt
    Figure 7. Mounting my CSE home directory from command-line
    If your login credentials on your Linux client (laptop) are not the same as your CSE credentials, enter your CSE login username to the User prompt. The Domain is cs.unl.edu as shown in figure 4. Enter your CSE password to the Password prompt. If successful, the shell command prompt is returned.
  • You can then create symbolic links from the mount-point directory under /run/user/<user-number>/gvfs/ into a place in your home directory that will help navigate to it:
    ln -s /run/user/1000/gvfs/smb-share\:server\=cse-smb1.unl.edu\,share\=wmotycka ~/Documents/CSE
    creates a symbolic-link (directory path), /home/wmotycka/Documents/CSE, to the CSE home directory of the user wmotycka that can be accessed from within the VS Code Explorer, Open Folder action.
    CSE home directory mount point navigation using symbolic link
    Figure 8. Navigating to the ~/public_html/homepage_jekyll project path on the CSE server using the symbolic-linked CSE path
  • Projects and source files that require compilers like C and C++ source will still need to be compiled from a shell command-line on CSE, since the compiler and libraries on your local Linux client system may not be compatible with the libraries installed on CSE. This does not preclude compiling and running your code on your local Linux client system, which you can do for testing and development.
  • Project management tools like git have extensions in VS Code that allow managing shared code projects and cloud-based source repositories through the VS Code application. The CSE server supports git and maven (mvn) source management as well as svn source version control. Code-base management can be performed from both within the VS Code application and using CSE server shell commands.

Back to top ↑



How to Format Your Thesis Using LaTeX

The Office of Graduate Studies dictates the style and format for a thesis at the University of Nebraska-Lincoln. Information about these standards can be found on their website for current students at http://www.unl.edu/gradstudies/current/, and specifically in a publication titled "Guidebook For Preparation and Submission of a Thesis". 

The Department of Mathematics maintains a LaTex class file that helps format your thesis to Nebraska's guidelines. This template may be helpful to Computer Science and Engineering students as well. Look for the "NU Thesis LaTeX Class File" under the Resources section of this page: https://math.unl.edu/current-graduate

Back to top ↑



Compilers and Interpreters available on cse.unl.edu

Compilers

gcc GNU CcCompiler
g++ GNU C++ compiler
javac Java compiler
gfortran GNU Fortran compiler
clisp Common Lisp
alisp Allegro Common Lisp

Interpreters

perl Perl command line scripting language
php Command line and web scripting language
ruby Command line and web scripting language
pyton Command line scripting language

Back to top ↑



A simple unix text editor - pico

To use pico, type "pico filename" where filename is the file you with to create or edit. Once in pico, you will see a list of pico commands you can use, shown on the bottom of the screen. The '^' symbols means <CTRL>. To view the pico help screen the command shown on the bottom of the screen is "^G" which means <CTRL>-G.

Back to top ↑



Basic Unix Commands

Note on systax used in document:
items in [] are optional
items in {} can be repeated 0 or more times.
fn = filename (possible with wildcards)
dir = directory name

File System:

cat fn {fn}
concatenate, can be used to display a file.
more fn {fn}
displays file(s) one screenful, at a time. At MORE prompt enter: space bar - for next screenful <cr> - for next line, q - to quit more command.
cp fn1 fn2
copy file - fn1 to fn2, fn1 remains.
mv fn1 fn2
move (rename) file - fn1 to fn2, fn1 no longer exists.
rm fn
remove (delete) file.
lpr -Pprinter_name fn
print a file, printer_name = ps16 or ps17.
ls [fn]
list files in current directory option filename is usually used to display files matching wildcards. (ie. ls *.s will list all assembly language source files.)
ls -lgRa
Recursive listing of all files within all subdirectories. Longest, most descriptive format.
cd [dir]
change working directory, ``home directory" if not specified. cd .. will backup one level in the directory structure.
pwd
print working directory path.
mkdir dir
make a new directory, giving it the name dir (within the current directory)
rmdir dir
remove (delete) the directory named dir (the directory must be empty)
file fn
Tries to determine what kind of information is in a file by consulting the file system index and by reading the file itself.
du
Prints a summary of total space occupied by all files in a hierarchy.
sort fn
Sorts ASCII files line-by-line.
chmod
Change file permissions. See the man pages for a complete description of settings. Use this command to determine whether files can be readable by other people.
find . -name filename
In it's most simple form find will display all files in this and any subdirectories which name matches filename. See the man page for find for a complete description of this command. Find can be use to find files matching name patters, dates, owners, sizes, etc. and to perform action on matched files.
gzip fn
Use this to compress files not needed immediately to conserve disk space. A ``.gz" will be appended to the filename.
gzip -d
Uncompresses files with ``.Z" at end of filename.
head {-n} fn
Prints first n lines of a text file. If no number is specified, the default is 10.
tail {-n} fn
Prints last n lines of a text file. If no number is specified, the default is 10.
tail {-n} fn
Prints last n lines of a text file. If no number is specified, the default is 10.
grep string fn
Print occurrences of string in file


Remote Connection:

ssh remote_host
Launch a secure shell to the remote host specified.


Communication:

finger
list users currently on the system.
who
list users currently on the system.
w
what, similar to who but includes what they are doing.
pine
Email message utility.
pine username
will send Email to username.
talk username
allows two users to have an interactive conversation over the computer.
write username
allows a user to put a message on another users screen.
mesg n
Makes it so other users cannot interrupt you with talk requests, and write messages.


Help:

man command
manual, returns the manual for the given command from the UNIX on-line manual. If you cannot find a man page for a command, there may be one in a directory that isn't in your MANPATH. Your MANPATH is setup in the .login file and a command's man page is usually in a man directory off the same parent directory as the command. For example, if the command is located in /usr/local/bin, its man page is probably in /usr/local/man.
man -k keyword
display manual headings containing the word keyword.


Miscellaneous:

alias name def
Assigns ``def'' to the alias ``name''. Usually found in the .cshrc file. For example ``alias dir ls -la''.
clear
Clears screen.
history
List history of commands used.
!!
re-execute the last command entered.
!x
re-execute the last command that started with the given letter, eg !c will re-execute the last command that began with the letter c.
jobs -l
list all currently stopped or background jobs with job numbers and process ID's.
kill [-signal] %jobnumber
kill the given job number. Use the "jobs" command to show running jobs. You might need to kill a job to logout if you have accidentally put a job into the background or stopped a job. Use -TERM or -KILL singlas to force quite jobs.

kill PID
kill the given Process. refer the "ps" command to find running processes. Use -TERM or -KILL singlas to force quite jobs.
ps -fa
list all your current processes. See the man page for a full description.
<control>C
kill the current process - the one in the  foreground
<control>Z
suspend foreground process.
bg
put a suspended job in the background.
fg
put a suspended or background job in the foreground.
date
display time and date.

To find out about more commands, click  here.

Back to top ↑



Editing a File on Unix with vi - Basic Commands.

What is  vi?

The default editor that comes with the UNIX operating system is called  vi ( visual editor). [Alternate editors for UNIX environments include  pico and  emacs, a product of GNU.]

The UNIX  vi editor is a full screen editor and has two modes of operation:

  1. Command mode commands which cause action to be taken on the file, and
  2. Insert mode in which entered text is inserted into the file.

In the command mode, every character typed is a command that does something to the text file being edited; a character typed in the command mode may even cause the  vi editor to enter the insert mode. In the insert mode, every character typed is added to the text in the file; pressing the  <Esc> ( Escape) key turns off the Insert mode.

While there are a number of  vi commands, just a handful of these is usually sufficient for beginning  vi users. To assist such users, this Web page contains a sampling of basic  vi commands. The most basic and useful commands are marked with an asterisk ( * or star) in the tables below. With practice, these commands should become automatic.

NOTE: Both UNIX and  vi are  case-sensitive. Be sure not to use a capital letter in place of a lowercase letter; the results will not be what you expect.

To Get Into and Out Of  vi

To Start  vi

To use  vi on a file, type in  vi filename. If the file named  filename exists, then the first page (or screen) of the file will be displayed; if the file does not exist, then an empty file and screen are created into which you may enter text.

* vi filename edit  filename starting at line 1
  vi -r filename recover  filename that was being edited when system crashed

To Exit  vi

Usually the new or modified file is saved when you leave  vi. However, it is also possible to quit  vi without saving the file.

Note: The cursor moves to bottom of screen whenever a colon ( :) is typed. This type of command is completed by hitting the  <Return> (or  <Enter>) key.

Basic Command Command Description
here :x <Return> quit  vi, writing out modified file to file named in original invocation
  :wq <Return> quit  vi, writing out modified file to file named in original invocation
  :q <Return> quit (or exit)  vi
 *  :q! <Return> quit  vi even though latest changes have not been saved for this  vi call

Moving the Cursor

Unlike many of the PC and MacIntosh editors,  the mouse does not move the cursor within the  vi editor screen (or window). You must use the the key commands listed below. On some UNIX platforms, the arrow keys may be used as well; however, since  vi was designed with the Qwerty keyboard (containing no arrow keys) in mind, the arrow keys sometimes produce strange effects in  vi and should be avoided.

If you go back and forth between a PC environment and a UNIX environment, you may find that this dissimilarity in methods for cursor movement is the most frustrating difference between the two.

In the table below, the symbol  ^ before a letter means that the  <Ctrl> key should be held down while the letter key is pressed.

Basic Command Command Description
* j  or  <Return>   [ or down-arrow] move cursor down one line
* k [ or up-arrow] move cursor up one line
* h  or  <Backspace>   [ or left-arrow] move cursor left one character
* l  or  <Space>   [ or right-arrow] move cursor right one character
* 0 (zero) move cursor to start of current line (the one with the cursor)
* $ move cursor to end of current line
  w move cursor to beginning of next word
  b move cursor back to beginning of preceding word
  :0 <Return>  or 1G move cursor to first line in file
  :n <Return>  or nG move cursor to line  n
  :$ <Return>  or G move cursor to last line in file

Screen Manipulation

The following commands allow the  vi editor screen (or window) to move up or down several lines and to be refreshed.

Basic Command Command Description
  ^f move forward one screen
  ^b move backward one screen
  ^d move down (forward) one half screen
  ^u move up (back) one half screen
  ^l redraws the screen
  ^r redraws the screen, removing deleted lines

Adding, Changing, and Deleting Text

Unlike PC editors, you cannot replace or delete text by highlighting it with the mouse. Instead use the commands in the following tables.

Perhaps the most important command is the one that allows you to back up and  undo your last action. Unfortunately, this command acts like a toggle, undoing and redoing your most recent action. You cannot go back more than one step.

* u UNDO WHATEVER YOU JUST DID; a simple toggle

The main purpose of an editor is to create, add, or modify text for a file.

Inserting or Adding Text

The following commands allow you to insert and add text. Each of these commands puts the  vi editor into insert mode; thus, the  <Esc> key must be pressed to terminate the entry of text and to put the  vi editor back into command mode.

Basic Command Command Description
* i insert text before cursor, until  <Esc> hit
  I insert text at beginning of current line, until  <Esc> hit
* a append text after cursor, until  <Esc> hit
  A append text to end of current line, until  <Esc> hit
* o open and put text in a new line below current line, until  <Esc> hit
* O open and put text in a new line above current line, until  <Esc> hit

Changing Text

The following commands allow you to modify text.

Basic Command Command Description
* r replace single character under cursor (no  <Esc> needed)
  R replace characters, starting with current cursor position, until  <Esc> hit
  cw change the current word with new text, starting with the character under cursor, until  <Esc> hit
  cNw change  N words beginning with character under cursor, until  <Esc> hit;   e.g.,  c5w changes 5 words
  C change (replace) the characters in the current line, until  <Esc> hit
  cc change (replace) the entire current line, stopping when  <Esc> is hit
  Ncc  or  cNc change (replace) the next N lines, starting with the current line, stopping when  <Esc> is hit

Deleting Text

The following commands allow you to delete text.

Basic Command Command Description
* x delete single character under cursor
  Nx delete N characters, starting with character under cursor
  dw delete the single word beginning with character under cursor
  dNw delete  N words beginning with character under cursor;   e.g.,  d5w deletes 5 words
  D delete the remainder of the line, starting with current cursor position
* dd delete entire current line
  Ndd  or  dNd delete  N lines, beginning with the current line;   e.g.,  5dd deletes 5 lines

Cutting and Pasting Text

The following commands allow you to copy and paste text.

Basic Command Command Description
  yy copy (yank, cut) the current line into the buffer
  Nyy  or  yNy copy (yank, cut) the next N lines, including the current line, into the buffer
  p put (paste) the line(s) in the buffer into the text after the current line

Other Commands

Searching Text

A common occurrence in text editing is to replace one word or phase by another. To locate instances of particular sets of characters (or strings), use the following commands.

Basic Command Command Description
  /string search forward for occurrence of  string in text
  ?string search backward for occurrence of  string in text
  n move to next occurrence of search string
  N move to next occurrence of search string in opposite direction

Determining Line Numbers

Being able to determine the line number of the current line or the total number of lines in the file being edited is sometimes useful.

Basic Command Command Description
  :.= returns line number of current line at bottom of screen
  := returns the total number of lines at bottom of screen
  ^g provides the current line number, along with the total number of lines, In the file at the bottom of the screen

Saving and Reading Files

These commands permit you to input and output files other than the named file with which you are currently working.

Basic Command Command Description
  :r filename <Return> read file named  filename and insert after current line (the line with cursor)
  :w <Return> write current contents to file named in original  vi call
  :w newfile <Return> write current contents to a new file named  newfile
  :12,35w smallfile <Return> write the contents of the lines numbered 12 through 35 to a new file named  smallfile
  :w! prevfile <Return> write current contents over a pre-existing file named  prevfile

Back to top ↑



MySQL Database Account — Requesting and Connecting

MySQL is the general purpose database subsystem provided by the School of Computing (SoC) for student use. Each user is allowed one database. This database is automatically created after requested by a user and is named the same as your SoC systems username. Users can create as many tables as they want but we ask that they keep all databases to a reasonable size.

Requesting a MySQL Account and Database
Any user with a SoC account can request access to the MySQL server running on the cse-linux-01.unl.edu server.  Users with legacy CSE server accounts can request access to the MySQL server running on the cse.unl.edu server.  To determine if you already have a MySQL account, log in to the SoC Account Management Utility (AMU) page at https://cse.unl.edu/account with your CSE account credentials. Once you log in, click the Account Settings link on the left page. If you have already been granted a MySQL account on one of the SoC servers (cse.unl.edu, cse-linux-01.unl.edu, or nuros.unl.edu) you will see a message indicating on which system(s):

If you do not have any MySQL accounts showing on Account Settings, you will need to send an email to support@cse.unl.edu requesting a MySQL account.  If you already have an account on the cse.unl.edu server, you may request a MySQL account on that system, otherwise your MySQL account will be created on the cse-linux-01.unl.edu server.

The MySQL credentials you receive will have a login that matches your CSE server (cse.unl.edu) username, but your password for the MySQL server is completely different from your CSE server password.

Accessing the MySQL server is done by one either logging into the cse.unl.edu server using your CSE username and password, or connecting to the cse.unl.edu server using a TCP/IP connection.

Connecting to MySQL Database
To connect to a MySQL database from the command-line on cse.unl.edu, type mysql -p and hit enter. The password you will be prompted for will be your MySQL password, which is different from your cse.unl.edu server password. Enter the MySQL password you received in the email message that was sent when you requested your account. You should be presented a MariaDB [(username)]> prompt from the MySQL application.

To connect to a MySQL database from the command line from another computer with the MySQL command line client installed. Run 'mysql -h cse.unl.edu -u YOUR_CSE_LOGIN -p' and hit enter. Note: the password you will be prompted for will be your MySQL password, which is different from your SoC password. MySQL passwords can be reset using the SoC Account Management Utility page.

TCP/IP connectivity requires authentication using your MySQL credentials and is supported on the standard MySQL service port, 3306, on the CSE server.

Back to top ↑