![]() |
"If we don't know it's broken we can't fix it!" |
|
The - in the place of a tar output filename directs tar to send its output to the standard output which is redirected to gzip. 2. How do I create a TAR archive of a directory?A common task in UNIX operating systems is creating an archive of many files or directories in a single file. The tar command is one option for archiving and has many options and can do many things. In a simple example, you can create a file called archive.tar of all the files and subdirectories in the current directory with the following command:
Note that this file is different from a zip archive commonly used in Windows environments because it is uncompressed. 3. How do I decompress and extract a TAR archive in one step?To extract the compressed TAR archive target.tar.gz into the current working directory with:
If the archive was compressed with the UNIX compress command (archive ending in .Z) you can use:
4. How do I create a symbolic link?A symbolic link is a pointer to another file or directory. It can be used just like the original file or directory. A symbolic link appears in a long listing (ls -l) with a reference to the original file/directory. A symbolic link, as opposed to a hard link, is required when linking from one filesystem to another and can be used within a filesystem as well. To create a symbolic link, the syntax of the command is similar to a copy or move command: existing file first, destination file second. For example, to link the directory /home/username/public_html/matt/private/forum to /phpbb for easy access, use:
5. How do I find files and directories?To search the current directory and all subdirectories for a folder or file, use the following command:
- where filename is the file or folder for which you are looking... To search one directory and all its subdirectories use the following command:
- where filename is the file or folder for which you are looking and foldername is the folder in which you want to search. 6. How do I find information on other UNIX commands?The UNIX command line interface is wonderful. With that power comes complexity if only in the sheer number of commands. Even seasoned UNIX gurus need help remembering the syntax of less frequently used commands. Fortunately, UNIX has a great built-in manual called man. To get information for a command such as cd, use:
If you are not sure what the name of a command is, try using a keyword search. The keywords are matched against the Name line in each known man page which contains the name of the command and a brief description of its function. To search for man pages relating to SQL databases, commands, or functions, use:
7. How do I launch SSH or Shell Access tools?OverviewSSH (Secure Shell) is a program to log into another computer/server over a network securely. It provides strong authentication and secure communications over insecure channels. Your login, commands, text are all encrypted when using ssh. You can login to your site via SSH through the control panel using a Java SSH client or directly from your computer using a third party SSH program. SSH allows secure file transfer and remote logins over the internet. Your connection via SSH is encrypted for a secure connection. You can manage your SSH keys to allow automation when logging in via SSH. Using public key authentication is an alternative to password authentication. Since the private key must be held to authenticate, it is virtually impossible to brute force. You can Import existing keys, generate new keys, as well as manage/delete keys. Java SSH LoginWhen using the Java SSH clients, you have your choice of two types of clients:
To use either client, click on the appropriate link. Third Party SSH Client SoftwareIn addition to the Java SSH clients, you can login using a third party SSH program, two popular programs are listed below:
To connect use the following configuration settings:
Manage SSH Keys(Advanced)Steps
The public and private key are similar to a puzzle. They are created together to use during the login/authentication process. The public key resides on the server (the remote location) The private key resides locally on your computer/server. When you attempt to login to a server, the public and private key are compared. If they "match", then you will be allowed to login to the server location. You can download the private/public keys here and import into PuTTY (or other SSH clients) if you prefer using something else for SSH connections. Or, if you have been using PuTTY, you can import the public/private keys by click on Import Key. You can also download your key in PuTTY's ppk format under View/Download.
The video below is a useful guide to SSH Access. 8. How do I setup a cron job?Via the "crontab" command from the shell.crontab -l will show you your currently set up cron jobs on the server. crontab -r will delete your current cron jobs. crontab -e will allow you to add or edit your current cron jobs by using your default text editor to edit your "crontab file". Your crontab includes all the cron jobs you'd like, with one cron entry per line. A cron entry looks like this: 45 2 * * * /home/user/script.pl
Here are some examples to help you learn the syntax for the numbers:
9. What are some commonly used UNIX shell commands?Creating a DirectoryYou can create a directory by using the mkdir command. For example, to create a directory named images within the current directory:
Changing your Current Working DirectoryAt any given time, you are located in some current working directory within the Unix file tree. When you log in, your current directory is set to your home directory. You can change your current working directory any time by using the cd command (this stands for "change directory"). For example, if the current directory has a subdirectory named details, you can change to that directory using the command:
You can always find out the absolute pathname of the current working directory by typing the command:
You can return to your home directory by typing:
Finding out what Files you HaveYou can see what files you have by using the ls command:
This command will give you a list of all the names of your files. Making a Copy of a FileIf you want to make an exact copy of the contents of a file, figure out what you want to name the copy, and then type the command
where oldname is the name of the existing file you want to copy. A new file will be created with the name newname and the same contents as the original. Changing the Name of a FileThe Unix mv command can be used to change the name of a file:
This will not affect the contents of the file. It will simply change its name from oldname to newname. Getting Rid of Unwanted Files Once you have no more need for a file, you can get rid of it permanently by using the Unix rm command. Warning! When you remove a file, it is gone forever. There is no easy way to get it back. Please be careful that you do not remove a file that you really need. To delete a file from your account, enter this command:
where name identifies the file you want to remove. you can remove more than one file at a time. For example, this command
would remove the three named files. |
| © Copyright 2018 Mick Wood § 105 Scholars Court, Kings Road, Lytham St Annes, Lancashire FY8 1QA |
| Tel: 07932 894260 § Email: mick@mickwood.com |
| Last Updated: 4 December, 2018 |