Basic UNIX commands and utilities
When managing your 20i web hosting, you may wish to enable SSH access for one or more of your packages.
Enabling SSH access will give you easier management of your package(s), as you'll be able to use UNIX commands and utilities to carry out tasks and activities.
Here's a list and explanation of some basic commands:
ls – 'ls' (list) is perhaps one of the more commonly used commands. It will list all of the files in the current working directory (the directory the user is currently-in).
[20i@localhost Public]$ ls
Documents Music Pictures
[20i@localhost Public]$ ls -lah
total 20K
drwxr-xr-x. 5 20i 20i 4.0K Jan 6 10:03 .
drwx------. 28 20i 20i 4.0K Jan 6 10:00 ..
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Documents
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Music
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Pictures
[20i@localhost Public]$
-lah - this series of letters changes the appearance of the output: 'l' means in the long list format (so it's ordered and more readable), 'a' means all files/directories (don't ignore hidden files that begin with a '.') and 'h' means to print sizes of files/directories in a human readable format, e.g., 1.0K, 234M, 3.5G instead of the exact number of bytes.
pwd – the 'pwd' command (print working directory), will output/write the full path of the current working directory.
[20i@localhost home]$ pwd
/home
[20i@localhost home]$
cd – 'cd' (change directory) allows a user to move from one directory to another.
[20i@localhost ~]$ cd Documents/
[20i@localhost Documents]$
mv – 'mv' (move) lets you move files and directories from one location to another.
[20i@localhost Public]$ ls -lah
total 20K
drwxr-xr-x. 5 20i 20i 4.0K Jan 6 10:06 .
drwx------. 28 20i 20i 4.0K Jan 6 10:00 ..
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Documents
-rw-rw-r--. 1 20i 20i 0 Jan 6 10:06 foo.txt
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Music
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Pictures
[20i@localhost Public]$ mv foo.txt Documents/
[20i@localhost Public]$ cd Documents/
[20i@localhost Documents]$ ls -lah
total 8.0K
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:07 .
drwxr-xr-x. 5 20i 20i 4.0K Jan 6 10:07 ..
-rw-rw-r--. 1 20i 20i 0 Jan 6 10:06 foo.txt
[20i@localhost Documents]$
cp – 'cp' (copy) will allow a user to copy files and directories from one location to another.
[20i@localhost Documents]$ ls -lah
total 12K
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:09 .
drwxr-xr-x. 6 20i 20i 4.0K Jan 6 10:11 ..
-rw-rw-r--. 1 20i 20i 12 Jan 6 10:09 foo.txt
[20i@localhost Documents]$ cp foo.txt foo2.txt
[20i@localhost Documents]$ ls -lah
total 16K
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:14 .
drwxr-xr-x. 6 20i 20i 4.0K Jan 6 10:11 ..
-rw-rw-r--. 1 20i 20i 12 Jan 6 10:14 foo2.txt
-rw-rw-r--. 1 20i 20i 12 Jan 6 10:09 foo.txt
[20i@localhost Documents]$
rm – 'rm' (remove) allows the removal of many types of objects, such as, files, directories, and symbolic links.
[20i@localhost Documents]$ ls -lah
total 12K
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:14 .
drwxr-xr-x. 6 20i 20i 4.0K Jan 6 10:11 ..
-rw-rw-r--. 1 20i 20i 12 Jan 6 10:14 foo2.txt
-rw-rw-r--. 1 20i 20i 12 Jan 6 10:09 foo.txt
[20i@localhost Documents]$ rm foo.txt foo2.txt
[20i@localhost Documents]$ ls -lah
total 16K
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:16 .
drwxr-xr-x. 6 20i 20i 4.0K Jan 6 10:11 ..
-rw-rw-r--. 1 20i 20i 12 Jan 6 10:09 foo.txt
[20i@localhost Documents]$
man – the 'man' (manual) command can be used to display the documentation/manual page(s) for command line tools.
[20i@localhost ~]$ man grep
mkdir – 'mkdir' (make directory) can be used to create a directory.
[20i@localhost Public]$ ls -lah
total 20K
drwxr-xr-x. 5 20i 20i 4.0K Jan 6 10:07 .
drwx------. 28 20i 20i 4.0K Jan 6 10:09 ..
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:09 Documents
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Music
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Pictures
[20i@localhost Public]$ mkdir Downloads
[20i@localhost Public]$ ls -lah
total 24K
drwxr-xr-x. 6 20i 20i 4.0K Jan 6 10:11 .
drwx------. 28 20i 20i 4.0K Jan 6 10:09 ..
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:09 Documents
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:11 Downloads
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Music
drwxrwxr-x. 2 20i 20i 4.0K Jan 6 10:03 Pictures
[20i@localhost Public]$
grep – 'grep' (global regular expression print) is a useful command line tool that allows you to search for patterns, and their corresponding lines, in the input file(s) specified.
[20i@localhost Documents]$ grep -n Test foo.txt
1:Test.
[20i@localhost Documents]$
du – 'du' will show the disk usage of the files and directories in the directory specified (if a directory is not specified, the current working directory will be used).
[20i@localhost Public]$ du -sh Documents/
8.0K Documents/
[20i@localhost Public]$