Using the terminal can be overwhelming for someone who is used to point and click, and taking the plunge without knowing the benefits won’t always seem like a good idea. But it is. A very good idea! It really is worth the investment – in the long run using the terminal will make you much more productive.
Here are a bunch of terminal commands I use every day – get to grip with this lot and you will find most of your basic tasks are covered.
Basic Terminal Commands
This will navigate you to the folder you enter in directory name. The folder name is relative to where you are at when you enter the command. For example, if you are in your home directory ( ~ ) and want to navigate to Downloads, it’s a simple cd Downloads.
This will move you up one level in the directory tree. So following the example from above, if you are in Downloads, cd ../ will take you back up to home.
You can chain your cd commands. This will take you up one level, and then down into ‘Pictures’.
Will list all the files and folders in the current directory, excluding hidden folders and files.
List with the modifier -a will return all files and folders in the current directory, including hidden folders and files.
Will list all the files and folders in the current directory with limited file information such as last modified date, size, owner, number of directories, and permissions.
chmod owners +/- permissions file_name
This will allow you to alter the permissions on a file. Owners can be one or all of u ( all other users ), g ( group ), o ( owner ). + / – indicates the allowing or denying of permissions to the preceding user types, and permissions is the type of permission, being r ( read ), w ( write ), or x ( execute ). Here’s an example:
chmod go+rw file_name
This command will grant read and write permissions to the group and owner of the file or folder.
chown owner:group file/folder
Change Owner. You specify the new owner and group, and then specify the file you want to apply the new owners to.
Remove. This will delete a file.
-R will modify the remove to be recursive. This is used when deleting a folder, so that all the files and folders within the target folder will also be deleted.
Will create a new file.
Will create a new folder
Lists the contents of the file.
And that’s your basics! Use them as much as possible. At first simple tasks such as creating or deleting a file may take longer, but with practice these tasks will become second nature. Within time you will zooming around the terminal like a pro, and it won’t take long to realise how much more powerful it is than using any gui.
If you would like to be kept up to date with new posts here at the web developing cat, then be sure to add your name to our mailing list below.