Finding your way on your first ever VPS ? Part II
Posted on 28-09-2014 05:00
A couple of weeks ago, I posted the 'Finding your way on your first ever VPS - Part I' tutorial. This is part 2 of that series in which I will introduce you to another couple of commands!
I am going to assume a Debian-based distribution in my examples. I'm using Ubuntu 14.04 more specifically. Most commands should work on any Linux distribution; the only distribution-specific commands are those for the package manager.
Ready? Set? Let's go!
Last time I have already shown you what to do if you need help (type '-help' behind a command). This help can sometimes be cumbersome, even cryptic. There are cases where you need more than just a single line of text.
'man' is the man for that job. If you type 'man' followed by another command (the name of the command/application you need help with) you get to see the manual for that command. So, for example, if you need more help with the command 'cd', type:
This will open a manual viewer where you can move around with the arrow keys, HOME, END, PAGE UP, and PAGE DOWN. If you want to quit the manual, press 'q' and you will return to your terminal shell.
Almost every application has a manual, though I do have to add that a small portion of them are quite bad. I doubt you will run into one of those any time soon, though.
The 'cp' command enables you to copy a file or a directory. If requires two paths and a parameter in case you would like to copy a directory. The first path is the source path, so the file or directory you want to copy. The second path is the destination path, the file or directory you want to copy it to. This does not have to exist. If the target file exists, cp will overwrite that file. If the target directory exists, cp will throw an error.
For example, to copy the file 'README.txt' to 'README-NEW.txt', type:
The above assumes the README.txt file is in the directory you are currently in. cp also works will full paths, though:
And you can even copy things to another directory:
Finally, copying a directory requires the '-r' parameter:
'mv' work very similarly to 'cp'. It enables you to move a file or a directory, which can also be used to rename things. If requires two paths. The first path is the source path, so the file or directory you want to move. The second path is the destination path, the file or directory you want to move it to.
For example, to move the file 'README.txt' to 'README-NEW.txt', type:
The above assumes the README.txt file is in the directory you are currently in. mv also works will full paths, though:
And you can even move things to another directory:
But, you can also move directories:
'rm' is both a helpful and a dangerous command. It allows you to remove files and directories.
rm takes one or more arguments of files to be removed. For example, if you want to remove the README.txt file, you type:
Again, this also works with a full path:
To remove a directory that is empty, just use that directory path:
To remove a directory and all files in it, you can use the '-r' parameter to remove files and directories recursively. You need to be very careful with this, because if you take it level too high, you could use more files than you intended.
I can't emphasize this enough: please be careful with rm!
To view text-based files, you can use the tool 'less'. Less can basically work with any text-based file, but does not have syntax highlighting. It is especially useful for viewing log files or configuration files.
For example, to view the system's log file (more about this later), type:
As you can see, less takes a path as an argument and that path needs to point to a file. Within less, you can use the arrow keys, HOME, END, PAGE UP, and PAGE DOWN to move around. Type 'q' to exit.
If you want to search for something inside less, type '/' followed by the word/term you are looking for and press ENTER. This will give you the first highlighted result, if any. If there is more than one result, keep pressing ENTER until you get the desired result.
That's it again for this part of the tutorial. You've now learned some more commands to find your way about, but also to actually do some things. Feel free to experiment further with these commands or browse through their manual pages to find out what else they can do. I've only shown a very small portion of the available options.
See you next time, in Part III!
Warning about ParkingCrew.com! Case: ParkingCrew.com acquires NameDrive.com but earnings are not transferred despite assurances and promises. Inquiries about this are ignored! It's just a con compagny. Don't do business with them!
|Jump to Forum
|Subject||Discussion Forum||Last Post|
|Finding your way on your first ever VPS ? Part III||Linux tutorials, Tips & Tricks||: 1||17-10-2016|
|Server monitoring with Icinga 2 ? Part 1: the server (Ubuntu host)||Linux tutorials, Tips & Tricks||: 1||17-10-2016|
|Server monitoring with Icinga 2 ? Part 2: the node (Ubuntu host)||Linux tutorials, Tips & Tricks||: 1||03-09-2015|
|Tutorial ? The LowEndCluster ? Part 4||Linux tutorials, Tips & Tricks||: 1||26-05-2015|
|Tutorial ? The LowEndCluster ? Part 3||Linux tutorials, Tips & Tricks||: 1||24-05-2015|