Purpose
The guide for installing LAMMPS relies on a basic knowledge of Linux and it's command line interface. You won't need any advanced knowledge to complete an install, but it is nice to know a few basic commands.
You can press up arrow to scroll through a list of previously entered commands.
Change Directory
cd
This changes directory, much like in windows. There are a few shortcuts that can be nice to know. We always start a linux session in the home directory, to get back here any time use
cd ~/
This can be followed by a known file path, for example
cd ~/lammps/
This command, and indeed most, will autocorrect on tab. This makes traversing directories much quicker.
you can traverse up one director by entering
cd ..
much like in Windows ./ represents current directory and ../ is the directory above the current.
Print Working Directory
pwd
This simply outputs the current working path to the current directory.
List
ls
This will list the current directory's contents. The colours mean different file / folder types. White is a file, blue is a directory, and red is a tar.gz archive for example.
ls -l
This will show more details about a file including its read/write permissions, group and owner
Modify this with
ls -l -h
To see human readable file sizes
ls -l -h ~/lammps/
Will list the contents of the /home/lammps directory regardless of current directory.
View / edit file contents
cat /filename/
This can be useful just to see a text file or config file, usually if you want to edit it you will need to use a text editor. Ubuntu ships with Nano.
nano /filename/
This will likely ask for sudo permissions to create files or edit them. See the section on sudo for more.
You do not need to be in a directory to act on it, for example, if I know there is a file in my home folder I want to look at or edit I can enter the full file path as the argument even though my current directory is something else
pwd
/home/daniel/Lammps/fftw-3.3.8
sudo nano ~/folder/filename.txt/
This will still open the file for editing and allow you to save it even though the working directory is elsewhere. This works for almost any command that by default operates in your current directory.
Sudo
Sudo basically means "do as admin" this will request the sudo pass, which would usually be the password you set up at the beginning. In most cases apps will need to be installed with sudo.
sudo apt-get install wget
if you run a command and get permission denied you can run
sudo !!
to run the last command entered as sudo.
Sudo usually won't ask for a password every time, there is a short cooldown on requests after which the pass will be requested again.
Manual
This command is very useful for discovering options and possible flags for commands. It displays the manual page for a given command. This will explain all possible inputs to a given command.
man ls
This will show the manual page for the given command. A useful variation if you are just unsure what a command is meant to do is
man -f ls
This will list the man pages that match the command entered along with the command's description. To get more info on how to effectively use the manual, type
man man