Linux Essentials for HPC | 2026 HPC Training Series #2
Transcript
Good afternoon, everybody. Welcome to the Research Computer Workshop Series, Linux Essentials for HPC. My name is Benny, and I'm joined by Syed today.
We're going to talk through the essential Linux skills you need to navigate, manage, and troubleshoot effectively in a high-performance computing environment. As a reminder, this workshop is being recorded and it will be made available on our website. Before we dive into our specific cluster, it helps to recognize the broader ecosystem.
Here are some of the most common Linux distribution you will encounter in research computing. While they have different package managers and release cycles, the core command line tools and concepts we cover today apply across almost all of them. Okay, so why do we use Linux for research computing? First, it's open source, having free access to source code to provide total transparency and customization.
Second, it offers unmatched flexibility, scaling easily from local developer laptop all the way up to massive cloud infrastructure and supercomputers. Third, it features robust security with strong permission management and quick community-driven updates. Finally, many distributions have zero licensing costs, making them ideal for large-scale deployment.
To put in perspective for user standpoint, student or researcher paying heavy licensing fees for enterprise hosting or proprietary operating system isn't practical. Linux gives you a secure, free and open source environment backed by a massive global community, eliminating financial barrier to high-end computing. A great practical example for this value is the traditional web hosting stack.
Instead of paying thousands of dollars for commercial enterprise licenses, like roughly $2,000 for Microsoft IIS or $4,000 for Microsoft SQL Server, Linux environment let you deploy powerful production-grade tools like Apache and MySQL, completely free of licensing fees. Now let's transition into navigating Linux itself. Over the next session, we will cover how files and directories are organized, how pathway works, how to read file content and how to redirect command output.
To get hands-on experience, we'll be using Columbia's Insomnia cluster. The system address is insomnia.rcs.columbia.edu. To log in, you will need your Columbia uni and password using the standard secure shell command shown on the slide. So for those who are not logging, please open your terminal if you're using an Apple.
For those who are using Windows, you can open the command line or PowerShell and type this command, replace uni with your actual uni. And then after that, it will, a dual screen will come up asking you to enter your choice for your dual code or you want to push. If you have any issues trying to log in, please type your concerns on the chat and one of my colleagues will able to assist you.
So let's continue now. Once you're logging, you can check basic system status with three quick command. Host, update and date.
So what does host name mean? As the name implies, it will return the name of the host that you're currently logged in. So in this case, the host that I'm currently logged in is called 2402-logging-001. And in some year, we have two logging new.
So this is 001 and this is 002. The reason for having two is for load balancing. Next, the next command is uptime.
The command uptime will show you how long the system has been running. In this case, it's 62 days, 23 hours, 33 minutes and currently has 41 users and the load is 7.65. Next, the command is date. When you type date and press enter, it will return the current system date.
So when you're working on a Linux system, a lot of time you want to know where you currently located. So in order to print out the working directory, you use the command called pwd. And pwd stands for print working directory.
So right now, my current location is slash insomnia home slash bc212 slash linux essential. So this is very important that you remember because from time to time, you need to check and make sure that you are in the right location before you execute a command such as removing a file. Next, in order to navigate on a Linux system, let's say you need to access another directory located on a share or another level on your home directory, you use the command cd, which stands for change directory.
So as I showed you earlier, I'm currently right now in this directory called linux-essentials. And I want to change directory, let's say to task four. So now I'm in this directory called task four.
So in order to save your content, you have to create folders or directories. In Linux, we call directories usually. So you would do a meg dir test.
As you can see now, there's a directory called test. Next, we'll cover this command called touch. Touch is used to create an empty file or if you want to touch up the timestamp of a file.
So let's go to test. And I will do touch myfile.txt. And we can see we created a new file called myfile.txt. Next, once you create a directory and you have content to it, sometimes you need to remove it. So how do you do that? You use the command call rm, which means remove.
So we want to remove test, rm-r test. So the dash r in here means recursively. So remove will go inside the test directory and delete everything in there one by one and then all the way up to its level and then delete the directory.
So like this, is it descending to the directory? You say yes. Remove the file, yes. Now, do you want to remove the directory itself? Yes.
Now you can see it's gone. So when you need to remove a file or directory, make sure that you are in the correct location because there are a lot of times you have similar name files, similar name directories or even identical ones, but a different location. So once you delete something, it's gone.
On any of our HPC clusters, there are no backup. So if you delete it, there's no recycle pin for you to recover. So keep that in mind, make sure that you do this, make sure that you're in the right place and then execute the remove command.
Next, we'll cover this called double period dot dot. So what dot dot means is it's a short or abbreviation, a shorthand for the directory above us. So it's basically the parent directory.
So right now we are under Linux essential. If I say cd dot dot, it will take me up one level up. So this is my home directory, the root of my home directory as you can see.
So the directory Linux essential is right here. So another related command is the dot, the single period. So the single period means the current directory means here, which I will cover later on during copy files.
So you just remember that dot dot means one level up is the parent and dot means current directory. So a lot of time when you're working on a Linux system, you have very long, deep file path. So sometimes you need to go back to your home directory very quickly.
So the fastest and easiest way is that you simply do cd and press enter and then it will take you back right where you were originally to your home directory. So another related command that also means is a shortcut to your home directory is the tilde that I will cover a little bit later. But the tilde is basically a shortcut for this entire thing here.
So when you type tilde, it means this literally. So in Linux, there are two type of path, the absolute path and the relative path. So absolute paths start from the root file system all the way to where your current working directory.
That entire thing is called the absolute path because it's absolute. There's only one path like that, there's no other path. A relative path would be something relative to where you currently is.
So the absolute path to where my home directory is slash insomnia001 slash home slash bc212. So there's no other directory like that. Relative path would be something if I'm referring to Linux essential.
So I will simply say cd Linux essential and it'll jump there. There is possibility that I have another Linux essential here, right? So this is the absolute path for this Linux essential. If I go back one up, then this Linux essential is relative to this one.
Now, Linux administrators are sometimes very lazy. And they try to find ways to cut a few keystrokes. So they have something called tap completion.
So what it does is that, for example, I want to change into Linux essential, right? And then I want, see, so I said tap, tap, it completes this for me. If there are multiple options, for example, and I press tap, stretch. All right, if there are multiple options, when you press tap, the system will show you multiple choices of it.
So you just simply complete your typing and it will complete it for you. So this not only works on file names or directory name, it's also worked for command lines. Next is the ls command.
So now you have a lot of directories, a lot of files. How do I see them? So you use the ls command, which is list directory. If you just type ls, it just show you the name of your files in alphabetical order.
And depending on how wide is your screen, it could be multiple columns. Usually people like to do ls dash l because it shows you more information. In here, on all the way to the right side is the file name or directory name followed by the timestamp.
And in here, this is the file size in bytes. This here is called the group directory. Sorry, it's the group ID.
And this is the owner ID. So this tells me that I own this directory and the people in this group also can have access to it. And this is called file system.
So file system is divided in three sections. The first three here controls the owner. The middle three controls the group and the last three, all others.
So in this case, for example, it means that the owner can read-write, the group can read and others can read. Now, I usually like to do ls test r. The reason is that the t tells you to sort it by time and the r reverse it, the order. So what it means is that we'll list content, sort it by time and having the newest files at the bottom.
This is very useful because if your directory is very long, all your new file will be all the way in the top and you will have to scroll up and you won't be able to see it if it's too long. So this way, reversing it, you can see it right away at the bottom. So now we'll... Okay, so now you have all these files.
You know how to navigate. What if you need to duplicate a file so that you can have a backup? So what you do is simply, let's say, okay. So under test, there's a test file.
So I will do cp test, test file and I want to copy it to the current location. So as you can see in here, I don't have anything called test file. Now I do.
Next. So now you can copy your file. You can navigate.
What if you want to delete a file that you no longer need? So we will close. So let's just go set delete cd test. So I'll just remove the file instead of whole directory.
So it's gone now. So again, make sure that when you delete something, you're in the right location and it is best if you type the absolute path. That way you will not mistaken the current test directory with some other test directory that you were somewhere else.
Using the absolute path is the most safer way to do it. Next. So we'll move the file.
So sometimes you don't duplicate the file. You just simply want to organize your file in an organized way. So now let's move test file into a directory that we wish to put it in.
Let's put it in test. So now test is gone. No, sorry.
It's not gone. It's moving to the test directory. So in Linux to rename a file, there's no separate command to rename it.
So what you do is you use the same command of to move file to rename a file. So you said move test file. That text, my new file.
So as you can see, the original file is called testfile.txt. And now it's called my new file. So how do you list the content of a text file? So we use the command cat, which means concatenate. And it will just display the content.
So use cat only on text file. Do not cat binary files. If you do that, your screen will get very messy.
And the only way to fix it is you have to exit out of it and relog it. So if Mary had a little lamb was a very long file, this thing would just zoom by and scroll and you weren't able to see what you really need. So there's another command that related to it is called head and tail.
So what it does is that if you say head, it will display the first 10 line. If you say tail, it will display the last 10 line. So I don't want 10 lines, I want five lines.
How do you do that? So you include the option dash n and then an integer, which represent the number of lines that you want to display. This example, five. You can say seven, whatever you like.
So head display the X number of lines of the file and tail display X number of line from the bottom up. So next we'll talk about W. So the command W show you some basic information of the system also. It tells you who is currently locked in, how long idle time and what processes are being run.
So if you look at me in here, at the time when I ran W, it captured that I was running W. Other people who are not doing anything, idling, it's just at the show, it will show bash. If they submitted any jobs, it will show you. So the next command is called man or manual.
So if you want to find out what all this Linux command does or how to fine tune each command, you will do man ls and we can see here that it will tell you the commands for ls list directories. And then earlier I show you to use the L dash L means long listing format, right? And then I use T is short by time with the newest first. So that's why I use the R in here to reverse it.
So most of the command on a Linux system has a man page. It's not 100%. I will say like 99% of the command will have a man page where you can do man as a cat, man ls for example.
So since I'm already showing this command called ls, ls is a very useful command to display content. So sometimes depending on your situation, you can just cat it or do a head or tail, but sometimes you want to use ls. What ls is different from other command is that you can scroll it, you can do sorting, which other command doesn't.
So for example, I can quickly show you. So let's say you're an administrator and you need to look at the log file. So if you were using head or tail, it would be impractical.
So using more, you can scroll back up or you can do a search, right? Now let's go through output redirection. So let's say we want to capture the output of a command or the output of your job. So let's say we want to capture this, right? So we call date and then capturing a file called the date and we capture it, right? So if we do it again, guess what happened? It will overwrite it, right? So when you use a single grader, then you have to be careful.
Whatever, if you already have something saved, whatever is in there, it will be overwritten. So if you don't want to overwrite it, what you can do is a double double greater than. What it does, it will append.
So as you can see, this is the previous output and this is the following output. If we do it again, it would just simply append to it. Next, we'll come to a very simple command called echo.
So echo will simply display what you type following after it. What is this for? It's sometimes you want to know like the value of an environment variable, for example, path. So path, what is path? This tells the system when you type a command where to search it.
And so you sometimes want to know a certain variable, what kind of value it contains before you modifying it. So now I will pass it along to Syed. He will talk about system health.
Thank you Benny, let me share my screen you guys can see my screen. Yes, we can Okay All right guys, so my name is Syed I'm a Senior Research system engineer here at Columbia University working with the HPC team I will be covering the health system portion of today's learning workshop so so So far we have covered Basic linux commands now, we will look at few commands That help us understand what's happening on the server For example, we can check how much memory is being used which processes are running and whether the system is busy We will also cover inodes which are important when working with a large number of files on an HPC cluster So let's go through these commands one by one So let's start with the free command So the command shows us How much memory is available on the server and how much is currently being used? So if I type free dash h m Let me remove this Okay So we are using free dash h m here the options help us display more values in a more readable format When we run this command you will see columns such as total Used free and available memory. So the one I want you to pay attention is available because linux also uses memory for caching so even If free memory looks slow that doesn't necessarily mean the server is running out of memory so Next is the top command Let me type it for you guys.
So This is very useful command because it shows Us what is happening on the server in real time? We can see cpu usage memory usage and list of processes currently running Unlike the previous command top keeps refreshing automatically Usually every three seconds. So if a server is running slowly This is one of the commands we can use to see whether our process is consuming a lot of cpu or memory So at the top we have system information including uh cpu and memory usage below that we can see the running processes the cpu and memory columns such as How many resources each process is using so you can also see the process id or pid Which is the same thing pid stands for process id uh to exit this screen, you can just simply press q and We can exit out from this and I will just press ctrl l to Lean my window, so next command is htop So now look let's look at htop. Let me run it for you first Okay, so it's very similar to top but it's a little more user-friendly and interactive So instead of just showing numbers, it gives us graphical bars for cpu and memory usage And also make it easier to navigate through running processes So another useful feature is the tree view which lets us use how processes are Related to one another so personally I find this easier to read than top especially when checking system activity So here at the top you can see cpu and memory usage bars And Below that is the process list you can use the arrow key to move through the list and f5 switches to the process tree view So when you're done, you can same just press q quit and it will Stop So next slide is vmstat so uh vmstats Is stands for virtual memory statistics So this command gives us a quick overview of cpu activity memory usage swap And disk io io mean input output So it is useful when troubleshooting performance issues because it doesn't use many system resources So let's focus on a few columns under memory.
We have free Which shows available unused memory under swap. We have si and so Which shows swap activity and on the right we have cpu usage So the us column is user cpu time. Sy is system cpu time and id is idle cpu time So this is another useful command for getting a quicker overview of system performance So let's go to the next slide, which is ps command So Now we are going to look at the ps command which stands for process status Let me clear ps so if I run that this command It shows the processes associated with our current terminal session So it's nothing related with the server or anything.
It's just showing only my current terminal session so for example, you will normally see your shell which is the command line environment you're using along with the Ps command which I just earlier I ran this command So it's showing with the process id and before that it was just my bash shell and If uh, so this just tells us our current Shell if I add the dash e with this so Earlier ps only showed process associated with our current terminal. So by adding dash e We are actually asking linux to display all processes visible on this server. So we are on login zero zero two So it's showing all the processes running on this login server So you will notice that the output is much longer this includes background services and other processes running on the system so That's the one thing with the dash e and if we go with Dash aux Which is our next slide So let me scroll up on the top.
So we have more Visibility what is what so we can understand it easily Okay, so right here so This time we we are asking for a more detailed list of process In addition to the process id we can see which user owns the process How much cpu and memory is using and the command that is started? This is useful when troubleshooting because we can identify which processes are using system resources Here we have the user column which tells us who own the process it is the process id Then we have cpu and memory usage percentages and finally the command column shows what program our Command is running. So compare with the basic ps command. This gives us much more information Let's move on to the next slide, which is inodes.
So let's talk about inodes This is something uh, that is very important when working on an hpc cluster like insomnia or ginsburg So an inode stores information about a file or directory such as its owner permissions size and timestamps So it doesn't store the actual file name or file Consume inodes, for example, let's say a researcher runs a job that generates millions of very small files Even though those files might not take up much storage space They are still using inodes and if a file system runs out of available inodes You may not be able to create any new files, even if there is still plenty of disk space available So when checking storage issue, we also need to pay attention to inode usage Let me clear my screen and I think my vpn is just got down Let me connect to it again This was the perfect time For the vpn to go down Let me come back Okay, so we talk about inodes so Now, let's see how can Uh, we check inode usage So we use the df command in with that. Uh, Dash i option this shows inode usage instead of regular disk space So df-i And we can see Uh Like all these this is all information about the inodes not the regular memory so Here you can see the file system total number of inodes how many are used how many are free and the percentage usage So now let's check two specific paths on insomnia Which is my home directory. So df-i Slash insomnia001 slash home and my uni id so The first path we we can see the reported inode usage is 88% That means a large portion of reported inode Capacity is already in use So if I run the second path, I just press arrow and delete this and type rcs so Now for the second path the reported usage is 56% So we can see different inode usage number Depending on the path and how the file system reports its accounting Both locations are under slash insomnia001 So these numbers don't necessarily mean each directory has its own separate inode quota the important column to remember is Use percentage which tells us the percentage of inodes being used and That's why checking inodes can be useful when troubleshooting file creation Or storage issues on insomnia or hpc any like cluster Ginsberg or insomnia any hpc cluster So let's move on to the next slide.
Let me clear Okay Okay All right. So now that we have gone through our system health commands Let's look at how to properly log out of the cluster There are a few ways to do this in linux The first and easiest way is using exit command when we type exit it closed our current shell session We are continued to insomnia through ssh This will disconnect us from the cluster and took it back to our local terminal. So if I Type exit so you can see we were in login 002 on insomnia.
So now i'm going back on my macbook So one thing to remember is that exit ends your current Shell session. It doesn't shut down the server or affect other users And it just properly disconnect you from the server There are a few other options log out or ctrl d but I will suggest exit is enough for exiting out from any Server or shell session safely So that brings us to the end of today's presentation Today we have covered How to navigate a linux system create our managed files And perform basic system health checks, so if you have any questions or would like to Any additional information on anything we have covered today, please feel free to contact us at at hpc-admin At columbia.edu our team will be happy to assist you So looking ahead next thursday We will be covering text editing using a tool called win and the following week. We will focus on slurm and job scheduling So including how to write batch scripts and submit your first job to the cluster So thank you all for attending today.
So before we wrap up. Does anyone have any questions feel free Um, is it me or did the audio just cut out? No, I just stopped talking Okay, sorry Okay And just to clarify for those who have registered the vim session is uh this thursday, so we will see you very soon And yes, we will also share the slides we use for this session After this meeting ends Yeah, we'll get the video up and i'll get the slides out to folks, uh end of today early tomorrow um also If you have any feedback, you know, we change these sessions every semester based on what people You know things change a lot based on what people need. So if you have feedback, please, uh Send your I just dropped a link in the chat about that.
So please feel free to share what you think That would be very helpful to us But yes, the table is open for questions about actual linux the recording. Uh, I will Will be on this what we call the video library. It will be here That's where you'll see the first session from a couple weeks ago, and then i'll the future ones Now it's open for linux.
Okay. Well in that case, uh How do you recommend people practice? Yeah, they don't need to uh remember Uh each and everything from what we covered today Just more and more hands-on practice will make them perfect and slowly slowly adopt All these commands you don't have to memorize all these commands which we use today And it's going to take a little bit time When you guys will do hands-on So you will have more uh Idea of how to navigate in the linux system. It's not windows where we can see the folders and files It's just a screen black screen with the numbers are and letters.
So the more practice the more uh perfect you will be So as I mentioned earlier, uh, your best friend is the man pages So man in the command That's how you find out anything and everything about how to use a particular command And second it will be cool. So This too will be your best friend And lastly just to say um, if those of you who don't have a linux environment, uh, you you are free to actually request a free account via hpc support at hpc hyphen support at columbia.edu So, uh open a ticket request a free account. We'll get you situated.
You have limited resources. You have five Terabytes, which is shared amongst the pool But you'll have access to actually launch jobs and pre-navigate the system um Next week we'll be showing you how to actually submit jobs onto the login and cpu and high memory nodes So make sure you um come along And on thursday, you'll get to know that to actually modify a text file So next class is a key to launching jobs on the system But again to answer the question if you want to navigate or practice key syntax Request a free account and we'll get you situated The thursday session is closed. But if you're in today's session, I can probably add you.
Um So I will follow up with you after offline Okay, perfect. So if there's any other questions, we'll close today's session Jess will get the emails out with the video and the pdf slides and hopefully we see you guys on thursday Thank you side. Thank you.
Benny. Thank you so much guys for attending today's class and we'll see you next week Thank you. Bye.
We're going to talk through the essential Linux skills you need to navigate, manage, and troubleshoot effectively in a high-performance computing environment. As a reminder, this workshop is being recorded and it will be made available on our website. Before we dive into our specific cluster, it helps to recognize the broader ecosystem.
Here are some of the most common Linux distribution you will encounter in research computing. While they have different package managers and release cycles, the core command line tools and concepts we cover today apply across almost all of them. Okay, so why do we use Linux for research computing? First, it's open source, having free access to source code to provide total transparency and customization.
Second, it offers unmatched flexibility, scaling easily from local developer laptop all the way up to massive cloud infrastructure and supercomputers. Third, it features robust security with strong permission management and quick community-driven updates. Finally, many distributions have zero licensing costs, making them ideal for large-scale deployment.
To put in perspective for user standpoint, student or researcher paying heavy licensing fees for enterprise hosting or proprietary operating system isn't practical. Linux gives you a secure, free and open source environment backed by a massive global community, eliminating financial barrier to high-end computing. A great practical example for this value is the traditional web hosting stack.
Instead of paying thousands of dollars for commercial enterprise licenses, like roughly $2,000 for Microsoft IIS or $4,000 for Microsoft SQL Server, Linux environment let you deploy powerful production-grade tools like Apache and MySQL, completely free of licensing fees. Now let's transition into navigating Linux itself. Over the next session, we will cover how files and directories are organized, how pathway works, how to read file content and how to redirect command output.
To get hands-on experience, we'll be using Columbia's Insomnia cluster. The system address is insomnia.rcs.columbia.edu. To log in, you will need your Columbia uni and password using the standard secure shell command shown on the slide. So for those who are not logging, please open your terminal if you're using an Apple.
For those who are using Windows, you can open the command line or PowerShell and type this command, replace uni with your actual uni. And then after that, it will, a dual screen will come up asking you to enter your choice for your dual code or you want to push. If you have any issues trying to log in, please type your concerns on the chat and one of my colleagues will able to assist you.
So let's continue now. Once you're logging, you can check basic system status with three quick command. Host, update and date.
So what does host name mean? As the name implies, it will return the name of the host that you're currently logged in. So in this case, the host that I'm currently logged in is called 2402-logging-001. And in some year, we have two logging new.
So this is 001 and this is 002. The reason for having two is for load balancing. Next, the next command is uptime.
The command uptime will show you how long the system has been running. In this case, it's 62 days, 23 hours, 33 minutes and currently has 41 users and the load is 7.65. Next, the command is date. When you type date and press enter, it will return the current system date.
So when you're working on a Linux system, a lot of time you want to know where you currently located. So in order to print out the working directory, you use the command called pwd. And pwd stands for print working directory.
So right now, my current location is slash insomnia home slash bc212 slash linux essential. So this is very important that you remember because from time to time, you need to check and make sure that you are in the right location before you execute a command such as removing a file. Next, in order to navigate on a Linux system, let's say you need to access another directory located on a share or another level on your home directory, you use the command cd, which stands for change directory.
So as I showed you earlier, I'm currently right now in this directory called linux-essentials. And I want to change directory, let's say to task four. So now I'm in this directory called task four.
So in order to save your content, you have to create folders or directories. In Linux, we call directories usually. So you would do a meg dir test.
As you can see now, there's a directory called test. Next, we'll cover this command called touch. Touch is used to create an empty file or if you want to touch up the timestamp of a file.
So let's go to test. And I will do touch myfile.txt. And we can see we created a new file called myfile.txt. Next, once you create a directory and you have content to it, sometimes you need to remove it. So how do you do that? You use the command call rm, which means remove.
So we want to remove test, rm-r test. So the dash r in here means recursively. So remove will go inside the test directory and delete everything in there one by one and then all the way up to its level and then delete the directory.
So like this, is it descending to the directory? You say yes. Remove the file, yes. Now, do you want to remove the directory itself? Yes.
Now you can see it's gone. So when you need to remove a file or directory, make sure that you are in the correct location because there are a lot of times you have similar name files, similar name directories or even identical ones, but a different location. So once you delete something, it's gone.
On any of our HPC clusters, there are no backup. So if you delete it, there's no recycle pin for you to recover. So keep that in mind, make sure that you do this, make sure that you're in the right place and then execute the remove command.
Next, we'll cover this called double period dot dot. So what dot dot means is it's a short or abbreviation, a shorthand for the directory above us. So it's basically the parent directory.
So right now we are under Linux essential. If I say cd dot dot, it will take me up one level up. So this is my home directory, the root of my home directory as you can see.
So the directory Linux essential is right here. So another related command is the dot, the single period. So the single period means the current directory means here, which I will cover later on during copy files.
So you just remember that dot dot means one level up is the parent and dot means current directory. So a lot of time when you're working on a Linux system, you have very long, deep file path. So sometimes you need to go back to your home directory very quickly.
So the fastest and easiest way is that you simply do cd and press enter and then it will take you back right where you were originally to your home directory. So another related command that also means is a shortcut to your home directory is the tilde that I will cover a little bit later. But the tilde is basically a shortcut for this entire thing here.
So when you type tilde, it means this literally. So in Linux, there are two type of path, the absolute path and the relative path. So absolute paths start from the root file system all the way to where your current working directory.
That entire thing is called the absolute path because it's absolute. There's only one path like that, there's no other path. A relative path would be something relative to where you currently is.
So the absolute path to where my home directory is slash insomnia001 slash home slash bc212. So there's no other directory like that. Relative path would be something if I'm referring to Linux essential.
So I will simply say cd Linux essential and it'll jump there. There is possibility that I have another Linux essential here, right? So this is the absolute path for this Linux essential. If I go back one up, then this Linux essential is relative to this one.
Now, Linux administrators are sometimes very lazy. And they try to find ways to cut a few keystrokes. So they have something called tap completion.
So what it does is that, for example, I want to change into Linux essential, right? And then I want, see, so I said tap, tap, it completes this for me. If there are multiple options, for example, and I press tap, stretch. All right, if there are multiple options, when you press tap, the system will show you multiple choices of it.
So you just simply complete your typing and it will complete it for you. So this not only works on file names or directory name, it's also worked for command lines. Next is the ls command.
So now you have a lot of directories, a lot of files. How do I see them? So you use the ls command, which is list directory. If you just type ls, it just show you the name of your files in alphabetical order.
And depending on how wide is your screen, it could be multiple columns. Usually people like to do ls dash l because it shows you more information. In here, on all the way to the right side is the file name or directory name followed by the timestamp.
And in here, this is the file size in bytes. This here is called the group directory. Sorry, it's the group ID.
And this is the owner ID. So this tells me that I own this directory and the people in this group also can have access to it. And this is called file system.
So file system is divided in three sections. The first three here controls the owner. The middle three controls the group and the last three, all others.
So in this case, for example, it means that the owner can read-write, the group can read and others can read. Now, I usually like to do ls test r. The reason is that the t tells you to sort it by time and the r reverse it, the order. So what it means is that we'll list content, sort it by time and having the newest files at the bottom.
This is very useful because if your directory is very long, all your new file will be all the way in the top and you will have to scroll up and you won't be able to see it if it's too long. So this way, reversing it, you can see it right away at the bottom. So now we'll... Okay, so now you have all these files.
You know how to navigate. What if you need to duplicate a file so that you can have a backup? So what you do is simply, let's say, okay. So under test, there's a test file.
So I will do cp test, test file and I want to copy it to the current location. So as you can see in here, I don't have anything called test file. Now I do.
Next. So now you can copy your file. You can navigate.
What if you want to delete a file that you no longer need? So we will close. So let's just go set delete cd test. So I'll just remove the file instead of whole directory.
So it's gone now. So again, make sure that when you delete something, you're in the right location and it is best if you type the absolute path. That way you will not mistaken the current test directory with some other test directory that you were somewhere else.
Using the absolute path is the most safer way to do it. Next. So we'll move the file.
So sometimes you don't duplicate the file. You just simply want to organize your file in an organized way. So now let's move test file into a directory that we wish to put it in.
Let's put it in test. So now test is gone. No, sorry.
It's not gone. It's moving to the test directory. So in Linux to rename a file, there's no separate command to rename it.
So what you do is you use the same command of to move file to rename a file. So you said move test file. That text, my new file.
So as you can see, the original file is called testfile.txt. And now it's called my new file. So how do you list the content of a text file? So we use the command cat, which means concatenate. And it will just display the content.
So use cat only on text file. Do not cat binary files. If you do that, your screen will get very messy.
And the only way to fix it is you have to exit out of it and relog it. So if Mary had a little lamb was a very long file, this thing would just zoom by and scroll and you weren't able to see what you really need. So there's another command that related to it is called head and tail.
So what it does is that if you say head, it will display the first 10 line. If you say tail, it will display the last 10 line. So I don't want 10 lines, I want five lines.
How do you do that? So you include the option dash n and then an integer, which represent the number of lines that you want to display. This example, five. You can say seven, whatever you like.
So head display the X number of lines of the file and tail display X number of line from the bottom up. So next we'll talk about W. So the command W show you some basic information of the system also. It tells you who is currently locked in, how long idle time and what processes are being run.
So if you look at me in here, at the time when I ran W, it captured that I was running W. Other people who are not doing anything, idling, it's just at the show, it will show bash. If they submitted any jobs, it will show you. So the next command is called man or manual.
So if you want to find out what all this Linux command does or how to fine tune each command, you will do man ls and we can see here that it will tell you the commands for ls list directories. And then earlier I show you to use the L dash L means long listing format, right? And then I use T is short by time with the newest first. So that's why I use the R in here to reverse it.
So most of the command on a Linux system has a man page. It's not 100%. I will say like 99% of the command will have a man page where you can do man as a cat, man ls for example.
So since I'm already showing this command called ls, ls is a very useful command to display content. So sometimes depending on your situation, you can just cat it or do a head or tail, but sometimes you want to use ls. What ls is different from other command is that you can scroll it, you can do sorting, which other command doesn't.
So for example, I can quickly show you. So let's say you're an administrator and you need to look at the log file. So if you were using head or tail, it would be impractical.
So using more, you can scroll back up or you can do a search, right? Now let's go through output redirection. So let's say we want to capture the output of a command or the output of your job. So let's say we want to capture this, right? So we call date and then capturing a file called the date and we capture it, right? So if we do it again, guess what happened? It will overwrite it, right? So when you use a single grader, then you have to be careful.
Whatever, if you already have something saved, whatever is in there, it will be overwritten. So if you don't want to overwrite it, what you can do is a double double greater than. What it does, it will append.
So as you can see, this is the previous output and this is the following output. If we do it again, it would just simply append to it. Next, we'll come to a very simple command called echo.
So echo will simply display what you type following after it. What is this for? It's sometimes you want to know like the value of an environment variable, for example, path. So path, what is path? This tells the system when you type a command where to search it.
And so you sometimes want to know a certain variable, what kind of value it contains before you modifying it. So now I will pass it along to Syed. He will talk about system health.
Thank you Benny, let me share my screen you guys can see my screen. Yes, we can Okay All right guys, so my name is Syed I'm a Senior Research system engineer here at Columbia University working with the HPC team I will be covering the health system portion of today's learning workshop so so So far we have covered Basic linux commands now, we will look at few commands That help us understand what's happening on the server For example, we can check how much memory is being used which processes are running and whether the system is busy We will also cover inodes which are important when working with a large number of files on an HPC cluster So let's go through these commands one by one So let's start with the free command So the command shows us How much memory is available on the server and how much is currently being used? So if I type free dash h m Let me remove this Okay So we are using free dash h m here the options help us display more values in a more readable format When we run this command you will see columns such as total Used free and available memory. So the one I want you to pay attention is available because linux also uses memory for caching so even If free memory looks slow that doesn't necessarily mean the server is running out of memory so Next is the top command Let me type it for you guys.
So This is very useful command because it shows Us what is happening on the server in real time? We can see cpu usage memory usage and list of processes currently running Unlike the previous command top keeps refreshing automatically Usually every three seconds. So if a server is running slowly This is one of the commands we can use to see whether our process is consuming a lot of cpu or memory So at the top we have system information including uh cpu and memory usage below that we can see the running processes the cpu and memory columns such as How many resources each process is using so you can also see the process id or pid Which is the same thing pid stands for process id uh to exit this screen, you can just simply press q and We can exit out from this and I will just press ctrl l to Lean my window, so next command is htop So now look let's look at htop. Let me run it for you first Okay, so it's very similar to top but it's a little more user-friendly and interactive So instead of just showing numbers, it gives us graphical bars for cpu and memory usage And also make it easier to navigate through running processes So another useful feature is the tree view which lets us use how processes are Related to one another so personally I find this easier to read than top especially when checking system activity So here at the top you can see cpu and memory usage bars And Below that is the process list you can use the arrow key to move through the list and f5 switches to the process tree view So when you're done, you can same just press q quit and it will Stop So next slide is vmstat so uh vmstats Is stands for virtual memory statistics So this command gives us a quick overview of cpu activity memory usage swap And disk io io mean input output So it is useful when troubleshooting performance issues because it doesn't use many system resources So let's focus on a few columns under memory.
We have free Which shows available unused memory under swap. We have si and so Which shows swap activity and on the right we have cpu usage So the us column is user cpu time. Sy is system cpu time and id is idle cpu time So this is another useful command for getting a quicker overview of system performance So let's go to the next slide, which is ps command So Now we are going to look at the ps command which stands for process status Let me clear ps so if I run that this command It shows the processes associated with our current terminal session So it's nothing related with the server or anything.
It's just showing only my current terminal session so for example, you will normally see your shell which is the command line environment you're using along with the Ps command which I just earlier I ran this command So it's showing with the process id and before that it was just my bash shell and If uh, so this just tells us our current Shell if I add the dash e with this so Earlier ps only showed process associated with our current terminal. So by adding dash e We are actually asking linux to display all processes visible on this server. So we are on login zero zero two So it's showing all the processes running on this login server So you will notice that the output is much longer this includes background services and other processes running on the system so That's the one thing with the dash e and if we go with Dash aux Which is our next slide So let me scroll up on the top.
So we have more Visibility what is what so we can understand it easily Okay, so right here so This time we we are asking for a more detailed list of process In addition to the process id we can see which user owns the process How much cpu and memory is using and the command that is started? This is useful when troubleshooting because we can identify which processes are using system resources Here we have the user column which tells us who own the process it is the process id Then we have cpu and memory usage percentages and finally the command column shows what program our Command is running. So compare with the basic ps command. This gives us much more information Let's move on to the next slide, which is inodes.
So let's talk about inodes This is something uh, that is very important when working on an hpc cluster like insomnia or ginsburg So an inode stores information about a file or directory such as its owner permissions size and timestamps So it doesn't store the actual file name or file Consume inodes, for example, let's say a researcher runs a job that generates millions of very small files Even though those files might not take up much storage space They are still using inodes and if a file system runs out of available inodes You may not be able to create any new files, even if there is still plenty of disk space available So when checking storage issue, we also need to pay attention to inode usage Let me clear my screen and I think my vpn is just got down Let me connect to it again This was the perfect time For the vpn to go down Let me come back Okay, so we talk about inodes so Now, let's see how can Uh, we check inode usage So we use the df command in with that. Uh, Dash i option this shows inode usage instead of regular disk space So df-i And we can see Uh Like all these this is all information about the inodes not the regular memory so Here you can see the file system total number of inodes how many are used how many are free and the percentage usage So now let's check two specific paths on insomnia Which is my home directory. So df-i Slash insomnia001 slash home and my uni id so The first path we we can see the reported inode usage is 88% That means a large portion of reported inode Capacity is already in use So if I run the second path, I just press arrow and delete this and type rcs so Now for the second path the reported usage is 56% So we can see different inode usage number Depending on the path and how the file system reports its accounting Both locations are under slash insomnia001 So these numbers don't necessarily mean each directory has its own separate inode quota the important column to remember is Use percentage which tells us the percentage of inodes being used and That's why checking inodes can be useful when troubleshooting file creation Or storage issues on insomnia or hpc any like cluster Ginsberg or insomnia any hpc cluster So let's move on to the next slide.
Let me clear Okay Okay All right. So now that we have gone through our system health commands Let's look at how to properly log out of the cluster There are a few ways to do this in linux The first and easiest way is using exit command when we type exit it closed our current shell session We are continued to insomnia through ssh This will disconnect us from the cluster and took it back to our local terminal. So if I Type exit so you can see we were in login 002 on insomnia.
So now i'm going back on my macbook So one thing to remember is that exit ends your current Shell session. It doesn't shut down the server or affect other users And it just properly disconnect you from the server There are a few other options log out or ctrl d but I will suggest exit is enough for exiting out from any Server or shell session safely So that brings us to the end of today's presentation Today we have covered How to navigate a linux system create our managed files And perform basic system health checks, so if you have any questions or would like to Any additional information on anything we have covered today, please feel free to contact us at at hpc-admin At columbia.edu our team will be happy to assist you So looking ahead next thursday We will be covering text editing using a tool called win and the following week. We will focus on slurm and job scheduling So including how to write batch scripts and submit your first job to the cluster So thank you all for attending today.
So before we wrap up. Does anyone have any questions feel free Um, is it me or did the audio just cut out? No, I just stopped talking Okay, sorry Okay And just to clarify for those who have registered the vim session is uh this thursday, so we will see you very soon And yes, we will also share the slides we use for this session After this meeting ends Yeah, we'll get the video up and i'll get the slides out to folks, uh end of today early tomorrow um also If you have any feedback, you know, we change these sessions every semester based on what people You know things change a lot based on what people need. So if you have feedback, please, uh Send your I just dropped a link in the chat about that.
So please feel free to share what you think That would be very helpful to us But yes, the table is open for questions about actual linux the recording. Uh, I will Will be on this what we call the video library. It will be here That's where you'll see the first session from a couple weeks ago, and then i'll the future ones Now it's open for linux.
Okay. Well in that case, uh How do you recommend people practice? Yeah, they don't need to uh remember Uh each and everything from what we covered today Just more and more hands-on practice will make them perfect and slowly slowly adopt All these commands you don't have to memorize all these commands which we use today And it's going to take a little bit time When you guys will do hands-on So you will have more uh Idea of how to navigate in the linux system. It's not windows where we can see the folders and files It's just a screen black screen with the numbers are and letters.
So the more practice the more uh perfect you will be So as I mentioned earlier, uh, your best friend is the man pages So man in the command That's how you find out anything and everything about how to use a particular command And second it will be cool. So This too will be your best friend And lastly just to say um, if those of you who don't have a linux environment, uh, you you are free to actually request a free account via hpc support at hpc hyphen support at columbia.edu So, uh open a ticket request a free account. We'll get you situated.
You have limited resources. You have five Terabytes, which is shared amongst the pool But you'll have access to actually launch jobs and pre-navigate the system um Next week we'll be showing you how to actually submit jobs onto the login and cpu and high memory nodes So make sure you um come along And on thursday, you'll get to know that to actually modify a text file So next class is a key to launching jobs on the system But again to answer the question if you want to navigate or practice key syntax Request a free account and we'll get you situated The thursday session is closed. But if you're in today's session, I can probably add you.
Um So I will follow up with you after offline Okay, perfect. So if there's any other questions, we'll close today's session Jess will get the emails out with the video and the pdf slides and hopefully we see you guys on thursday Thank you side. Thank you.
Benny. Thank you so much guys for attending today's class and we'll see you next week Thank you. Bye.
