Commands - Basic
From 2047Servers Support
| Line 9: | Line 9: | ||
== Creating Users / Groups == | == Creating Users / Groups == | ||
| − | See our full in depth guide on [[ | + | See our full in depth guide on [[Linux_User_%26_File_Management|Linux User & File Management]] |
==== Creating Users ==== | ==== Creating Users ==== | ||
| Line 36: | Line 36: | ||
As you use your server / install programs on it, you may find you need some software to run it. For example Minecraft Server requires you have Java installed as its main component. | As you use your server / install programs on it, you may find you need some software to run it. For example Minecraft Server requires you have Java installed as its main component. | ||
| + | |||
| + | If some software isn't installed & you are trying to run the software, The OS will kindly let you know it isn't installed & tell you the command to install it (For Common/Well known Software only) | ||
==== Installing Software ==== | ==== Installing Software ==== | ||
| Line 65: | Line 67: | ||
== Server Monitoring == | == Server Monitoring == | ||
| + | |||
| + | It is normally a good idea to add some server monitoring tools to your server, the most popular ones for game servers is creating a game server monitor button see a place like [http://www.gametracker.com Gametracker.com] These create banners like the example below, what can be useful to check on just to see how many players are on the server & if it is online. | ||
| + | |||
| + | [[File:gametracker.png|400px]] | ||
| + | |||
| + | Our favourite server monitoring tool is "htop" this is a bit like Windows Task Manager but for Linux, we install this software as standard, to run htop use command | ||
| + | |||
| + | <pre>htop</pre> | ||
| + | |||
| + | Below is a screenshot of what htop looks like, You can edit what is displayed on htop by press "f2" to go into the setup menu | ||
| + | |||
| + | [[File:htop.png|550px]] | ||
| + | |||
| + | Another great tool called "iftop" can be used to monitor your servers traffic, this tool lets you know who is connecting to your server & the network stats of the connection | ||
| + | |||
| + | <pre>iftop</pre> | ||
| + | |||
| + | Below is a screenshot of what iftop looks like | ||
| + | |||
| + | [[File:iftop.png|550px]] | ||
| + | |||
| + | Simple Commands like "free" can show memory usage | ||
| + | |||
| + | <pre>free</pre> | ||
| + | |||
| + | "du" can show the disk usage | ||
| + | |||
| + | <pre>du</pre> | ||
| + | |||
| + | "df" can show us the disk used/free space on each hard disk | ||
| + | |||
| + | <pre>df</pre> | ||
== File / Folder Management == | == File / Folder Management == | ||
| + | |||
| + | === Navigating around the file system === | ||
| + | |||
| + | To change which folder you are in / navigate to another folder you use the command "cd" (change directory) & then the folder path (you can press tab for auto complete, or tab tab for a list of options that match you search e.g. | ||
| + | |||
| + | <pre>cd /home</pre> | ||
| + | |||
| + | To navigate to the parent folder (folder above) use command "cd .." | ||
| + | |||
| + | <pre>cd ..</pre> | ||
| + | |||
| + | === Showing the contents of a folder === | ||
| + | |||
| + | To show the contents of a folder you can use the command "ls" (List) This will list all the files / folders in your current directory | ||
| + | |||
| + | <pre>ls</pre> | ||
| + | |||
| + | You can also use the better command "ls -l" this will list more information about the files / folders, including permissions, owner, size, last modified | ||
| + | |||
| + | <pre>ls -l</pre> | ||
| + | |||
| + | |||
| + | === Editing files === | ||
| + | |||
| + | For most of the time you should be able to do everything you need using the command line tools & file editors such as "nano" a brilliant command line text editor for Linux | ||
| + | |||
| + | This command will either open the file "file.txt" if it exists, or it will create a file "file.txt" using this text editor | ||
| + | |||
| + | <pre>nano file.txt</pre> | ||
| + | |||
| + | For other files with different file types that are not supported with text editors, it maybe best to download the file & then edit using a local computer | ||
| + | |||
| + | === Copying Files / Folders === | ||
| + | |||
| + | To copy a file / folder you use the command "cp" (Copy) & then the file you want to copy & then the destination e.g. for a single text file this command will copy "file1" to "file2" | ||
| + | |||
| + | <pre>cp file1.txt file2.txt</pre> | ||
| + | |||
| + | If you want to copy a folder the command is slightly different you just add the "-r" option to the command to specify you want to recursively copy a folder & its files within (This command will copy "folder1" into "folder2" | ||
| + | |||
| + | <pre>cp -r folder1/ folder2/</pre> | ||
| + | |||
| + | It is best to use the copy command if you want to move files / folders via command line. | ||
| + | |||
| + | === Renaming Files / Folders === | ||
| + | |||
| + | There are multiple ways of doing this, you could edit a file in a text editor like "nano" from the above example & then save it as a different name or you can use the "mv" command | ||
| + | |||
| + | In this example i will rename file1111.txt to file.txt | ||
| + | |||
| + | <pre>mv file1111.txt file.txt</pre> | ||
| + | |||
| + | You use the same command to rename a folder | ||
| + | |||
| + | <pre>mv folder1111 foldera</pre> | ||
| + | |||
| + | === Making Folders === | ||
| + | |||
| + | A very simple command for this one "mkdir" (Make Directory) in this example I will create a folder named testing | ||
| + | |||
| + | <pre>mkdir testing</pre> | ||
| + | |||
| + | You can also specify a path in which you want to create the folder in, very useful if you want to copy files from one place to another & placing them in a folder | ||
| + | |||
| + | <pre>mkdir /home/testing</pre> | ||
| + | |||
| + | |||
| + | === Deleting Folders === | ||
| + | |||
| + | If you want to delete a folder you use the command "rmdir" to delete an empty folder, if it has files inside it you use the command "rm -r foldername" example. | ||
| + | |||
| + | <pre>rm -r testing</pre> | ||
| + | |||
| + | See our full in depth guide on [[Linux_User_%26_File_Management|Linux User & File Management]] | ||