When working in Linux there are some basic commands that you might find useful to know. This guide is not an extensive list of all linux commands but ones that you might need to use when navigating around your QuickBox server.
Change Directory
If you want to change your directory or change which folder you are in, you can use the following command;
cd <path here>
CD stands for “Change Directory”. So for example, if you wanted to change into the home directory of your server, the command you would type is;
cd /home/<username>/
Elevate Permissions
Whenever you want to do anything with regards to QuickBox, you’ll need to elevate your permissions. The command to run for that is;
sudo su -
You must include the dash in the command otherwise it will not work.
Copying Files and Directories
If you wish to copy a file from one place to another, then you must use the copy command. You have to specify both the pathway of the file you wish to copy and the directory you want to move it too. In our example below, we are going to copy a text file from our Home folder, to our Documents folder.
cp /home/<username>/text.txt /home/<username>/Documents
If you wish to copy a directory, then you would still use the cp command, but add something additional to tell Linux that it’s a directory and not a file. All files and folders are case sensitive.
cp -r /home/<username>/test /home/<username>/Documents
Moving Files/Directories (Also Renaming)
Moving files and directories is slightly different than copying files. Moving files however is fairly simple. Like when copying files, you must tell Linux the location of the file currently, and then it’s new location afterwards. You would also use this command if you wanted to rename a file or directory.
mv /home/<username>/text.txt /home/<username>/Documents
Remove Directories and it’s containing files
Similarly to our previous commands, removing directories needs to include the full pathway to the directory. In addition, it is case sensitive as well, so if your folder starts with a capital letter, make sure you include that capital letter. The command will also remove the files contained within that folder.
rm -rf /home/<username>/test
List of Folders and Files
You might want to be able to see what files or folders are contained within a directory. To do this, you can use the command below.
ls -a
Create/Edit a File
If you wish to create or edit a file, then you can use the nano command to do so. You must specify the path and the file name for the file you wish to edit or create. If there isn’t a file with the name you’ve specified, it will allow you to create a new one. Otherwise, it will present you with the contents of that file
nano /home/<username>/text.txt
Reboot your Server
You can quickly and easily reboot your server by using the reboot command.
reboot
Change to a specific user
If you have different users on your server and you wish to run a command as that user, then you can use the command below to switch to that user.
su <username>
View information about your Hard Drives
If you wish to view information about your Hard Drives and particularly how much space you’ve got left, then you can run the following command to view that information.
df -h
You will then get an output like below.