obey-robots.txt
Web Master Trouble
Users Online
Guests Online: 1

Members Online: 0

Total Members: 3
Newest Member: Proxyhotdeals
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Last Seen Users
Your ad here below
View Thread
Web Master Trouble » Linux Apache MySQL PHP optimalisation tips tricks » Linux tutorials, Tips & Tricks
Linux tutorials, Tips & Tricks Getting started with SSH An introduction to NGINX, PHP-FPM and MariaDB on CentOS An introduction to NGINX, PHP-FPM and MariaDB on Ubuntu Getting started with OpenVZ! Handle DNS properly with cPanel Munin amass, all your server charts in one place Monitoring server performance with Munin! Getting started with OpenVPN (client) Getting started with OpenVPN (server) Your own mail server with Virtualmin IPtables: IPv6 and more rules
 Print Thread

Finding your way on your first ever VPS ? Part II

NuclearFusion

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!

man

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:

man cd

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.

cp

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:

cp README.txt README-NEW.txt

The above assumes the README.txt file is in the directory you are currently in. cp also works will full paths, though:

cp /home/johnsmith/README.txt /home/johnsmith/README-NEW.txt

And you can even copy things to another directory:

cp /home/johnsmith/README.txt /home/johnsmith/Documents/README-NEW.txt

Finally, copying a directory requires the '-r' parameter:

cp -r /home/johnsmith/directory1 /home/johnsmith/directory2

mv

'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:

mv README.txt README-NEW.txt

The above assumes the README.txt file is in the directory you are currently in. mv also works will full paths, though:

mv /home/johnsmith/README.txt /home/johnsmith/README-NEW.txt

And you can even move things to another directory:

mv /home/johnsmith/README.txt /home/johnsmith/Documents/README-NEW.txt

But, you can also move directories:

mv /home/johnsmith/directory1 /home/johnsmith/directory2

rm

'rm' is both a helpful and a dangerous command. It allows you to remove files and directories.

WARNING - Please be very careful with this command as it will often irrevocably remove files from your system without a way to get them back. Additionally, if may damage your system in such away that it may need to be reinstalled! - WARNING

rm takes one or more arguments of files to be removed. For example, if you want to remove the README.txt file, you type:

rm README.txt

Again, this also works with a full path:

rm /home/johnsmith/README.txt

To remove a directory that is empty, just use that directory path:

rm /home/johnsmith/emptydirectory

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.

rm -r /home/johnsmith/nonemptydirectory

I can't emphasize this enough: please be careful with rm!

less

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:

less /var/log/syslog

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.

Final notes

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:
New Thread Post Reply
Use this BBcode or HTML to refer to; 'Finding your way on your first ever VPS ? Part II'
BBcode:
HTML:
Vergelijkbare onderwerpen
Thread Forum Replies Last Post
Finding your way on your first ever VPS ? Part III Linux tutorials, Tips & Tricks 1 17-10-2016 09:24
Server monitoring with Icinga 2 ? Part 1: the server (Ubuntu host) Linux tutorials, Tips & Tricks 1 17-10-2016 09:21
Server monitoring with Icinga 2 ? Part 2: the node (Ubuntu host) Linux tutorials, Tips & Tricks 1 03-09-2015 07:15
Tutorial ? The LowEndCluster ? Part 4 Linux tutorials, Tips & Tricks 1 26-05-2015 07:15
Tutorial ? The LowEndCluster ? Part 3 Linux tutorials, Tips & Tricks 1 24-05-2015 13:17