Telnet/Cli Commands
From NMTWiki
| Applicable only for the following: |
|---|
| PCH NMT models: | A100/110/B110 |
|---|---|
| Others NMT's: | HDX/eGreat |
I quite often see on the forum and the WIKI various guides or apps that require some Telnet Cli knowledge.
These commands are what I collated from various guides and other sources. Please feel free to add/edit.
To Install Telnet use the Community_Software_Installer
You can use Telnet in a Windows environment by simply opening a Command Window and enter: telnet 192.168.1.xxx
Or you can use PuTTy and select Telnet option when you open PuTTy.
When asked for a login and password whichever guide you are using will normally ask you to login with username root and password field left blank/empty.
Contents |
File Management
Here are some useful commands for file manangement. Note that all file names are case sensitive.
- To go to a directory
- cd /directoryName
- To go up a directory.
- cd ..
- Make a directory
- mkdir /directoryName
- List contents of Directory
- dir (only in ftp)
or
- ls
- Check size of Directory and sub-directories
- du -ah /path/to/dir
- Find a file
- find / -name fileName
- Delete a file
- rm fileName
- Delete a directory and it's content
- rm -r directoryName
- Note: Use this command with great care
- Move or Rename a file
- mv /sourceDirectory/sourceFile /destination
- Copy a file
- cp /sourceDirectory/sourceFile /destination
- Copy groups of files
- cp /sourceDirectory/*.* /destination
- Copy a directory and any sub directories
- cp -a /sourceDirectory /destinationpath
- Create a uncompressed tar (.tar) archive
- To create a uncompressed (.tar) archive of all files directories and subdirectories in the current directory
- tar -cvf archivefilename.tar *
- Create a compressed tar (.tgz) archive
- To create a compressed (.tgz) archive of all files directories and subdirectories in the current directory
- tar -cvzf archivefilename.tgz *
- Unpack .tar archives
- For uncompressed .tar archives
- tar xvf file.tar
Unpack .tar.gz archives
- For gzip compressed .tar.gz archives
- tar xvzf file.tar.gz
Filename Completion - The TAB key
When typing any command (including the above examples), if you type part of a file name then immediate press the [TAB] button, then - if an existing file matches what is typed so far, the filename will be completed for you - if more than one file name is a possible match, it will beep, press [TAB] again and it will display the list of matching files. - if no file name matches it will probably beep.
This is well worth learning as it saves a lot of time and reduces typing errors.
System Management
- Stop a process
- kill processID
- Stop a program
- killall programName
- View all processes
- ps
- View most active processes on the NMT (like Task Manager in Windows)
- top
Example of how top may appear:
Mem: 82772K used, 6964K free, 0K shrd, 1280K buff, 61380K cached Load average: 0.39 0.32 0.24 PID USER STATUS VSZ PPID %CPU %MEM COMMAND 1913 root R 1940 1892 1.5 2.1 top 948 root S 13092 1 0.1 14.5 gaya 882 root S 2856 1 0.1 3.1 upnpapp 1029 root S 1692 1 0.1 1.8 telnetd 886 root S 1400 884 0.1 1.5 mDNSNetMonitor 1027 root S 808 1 0.1 0.9 llink 1079 nobody S 39336 1059 0.0 43.8 httpd 1082 nobody S 39336 1059 0.0 43.8 httpd 1078 nobody S 39336 1059 0.0 43.8 httpd 1081 nobody S 39336 1059 0.0 43.8 httpd 1080 nobody S 39336 1059 0.0 43.8 httpd 1059 nobody S 39312 1 0.0 43.7 httpd 1481 root S 13092 948 0.0 14.5 gaya 1482 root S 13092 1481 0.0 14.5 gaya 1110 root S 6732 1 0.0 7.4 smbd 1116 root S 6732 1110 0.0 7.4 smbd 1105 root S 3640 1 0.0 4.0 nmbd 884 root S 2856 883 0.0 3.1 upnpapp 885 root S 2856 883 0.0 3.1 upnpapp 883 root S 2856 882 0.0 3.1 upnpapp 877 root S 2832 1 0.0 3.1 sybhttpd
(Exit with ctrl+C)
Restart Services
- ftp
- samba
System Information
Other References
Basic commands for the Linux vi Editor
The Linux VI Editor is a text based editor used Linux, useful for editing configuration files or creating plain text documents.
| Command | Description |
|---|---|
| i | insert mode, (ESC to exit insert mode) allows text to be entered on the screen |
| a | Append to right mode |
| /word | Move to the occurrence of "word" |
| n | Locate the next occurrence |
| w | Advance to the next word |
| e | Advance to the next end of a word |
| b | Move to the previous word |
| 3b | Move backward 3 words |
| yy | Copy line (then move cursor and use p to paste after current cursor line) |
| dd | delete line |
| 3dd | delete 3 lines |
| D | Delete remainder of a line |
| dw | Delete word |
| x | Delete character |
| o | Open space for new line below the cursor line |
| O | Open a line above the cursor |
| CTRL-w | Move back a word in append mode |
| u | Undo last |
| U | Undo all changes to current line |
| . | In command mode, repeat the last text changing the command on the current line |
| :w newfilename | save the file to newfilename from the command mode |
| :wq | save and quit |
| :q! | quit without saving |
| r | replace then typa a character ot be replaced with r then return to break up a line |
| J | join 2 lines |
| s | substitute (sentence) typed text over a character, ESC when done |
| cw | change word |
| c | change part of a line from the cursor to the end of the line |
| cc | substitute new text for aline, ESC when done |
| h | move the cursor back one space |
| H | move the cursor to the highest line on the screen |
| L | move the cursor to the lowest line on the screen |
| M | position the cursor at the midpoint on the screen |
| G | last line in the file |
| 0 (zero) | Move the cursor to the beginning of the line it is on |
| view filename | Open a file for viewing only |
| set number | Turn on line numbers |
| set nonumber | Turn off line numbers |
Options
| Command | Description |
|---|---|
| autoindent | (ai ctrl-d to move to the left |
| showmatch | match brackets and parenthesis |
| tabstop=4 | |
| wrapmargine(wm) | when line is wrapped (80-value) |
| :2 copy 4 | Place a copy of line 2 after line 4. |
| :1,4 copy 7 | (lines 1-4) |
| :n | Access the next file for editing |
