Path: blob/master/part-1/prerequisites/basic-linux-commands.md
1200 views
------Basic Linux commands
‼️ To begin make sure you have a user account at CSC that is a member of a project which has access to the Puhti service.
☝🏻 You should also have already logged in to Puhti with SSH or via the Puhti web interface (and opened a login node shell).
Navigating folders
Now that you have logged in to Puhti, check which folder you are in by typing
pwdand hittingEnter:Check if there are any files:
Make a directory and see if it appears:
Go to that folder.
💡 Note: if you just type cd and the first letter of the folder name, then hit tab key, the terminal completes the name. Handy!
Exploring files
Download a file into this new folder. Use the command
wgetfor downloading from a URL:Check what kind of file you got and what size it is using the
lscommand with some extra options:Use the
lesscommand to check out what the file looks like:To exit the
lesspreview of the file, hitq.💡 Tip: Instead of
lessyou can usecatwhich prints the content of the file(s) straight into the command line. For long textslessis recommended.Make a copy of this file:
Remove the file we originally downloaded (leave your own copy).
💡 Tip: If you don't want to have duplicate files you can use mv to 'move/rename' the file. Syntax is the same: mv /path/to/source/oldname /path/to/destination/newname.
More information
Learn how to edit that file in the next tutorial!
💡 For more information of a given command line command: type man command or command --help where command is replaced with the one that you need help with.
💡 Tip: If you remember a part of a command that you have used recently you can search for it with the command history | grep string. This will show all your used commands that have included the string string (replace this with the pattern you are searching for).