A familiarity with the structure of the SUSE Linux filesystem and how to navigate it is critical for any system administrator or user. One of the challenges that those using text-only or command-line systems often complain of is the apparent lack of ways to visualize files, directories, and their structure from the console.
In this lab look at ways to experience the files and directories on a filesystem in relation to each other, and from different perspectives.
Successfully complete this lab by achieving the following learning objectives:
- Use Command-Line Tools to Visualize Filesystem Structure
NOTE: The tree command is installed as the system comes live, it may be more than a minute before it’s installed and ready for use!
treecommand to visualize the structure of the SUSE Linux filesystem, limiting the depth of queries and using alternative display and searching methods. From our home directory, we can run
treewith no options. We’ll see all of the directories in
~/, in a tree format. Now, if we run the command against the root of the filesystem, we’ll get way more output than we can handle. But try it and see, just to say you did:
Remember that you can hit Ctrl +C to stop it. If we want to see that in bite-sized chunks, we can run the same command, but pipe it into
tree / | less
There’s still a lot of information there, but we can at least paginate through the results. But even better than that is redirecting all of the
treeoutput to a file:
tree / > root_file-listing.txt
But do we necessarily need all that? What if we just want to see the directories, and not all of the files in them all? Well, there’s an option for that:
tree -d /
That’s still a lot of information. What if we just want the
/and its immediate subdirectories (only one level down)? Let’s run this
tree -L 1
If we change that 1 to a 2, we’ll get two levels down from
/. We’ll notice that we’re getting files in our output. What if we only want to see directories? Well, run this:
tree -L 2 -d
Let’s sweeten the deal. Now we’re going to show just subdirectories, but we’re also going to show permissions. And this time we’ll just run it on a directory that’s smaller than
tree -d -p /usr/share/doc/release-notes
This will list out
/usr/share/doc/release-notes, then all of the subdirectories and their permissions, in a tree view.
There’s one last option we ought to see in action,
-f. This will show the path of each of the directories/files in the
tree -d -p -f /usr/share/doc/release-notes
Note: We can redirect the output from any of these commands to a text file, for later study.
- Use the Graphical File Manager to Create a Directory and Copy Files into that Directory
Logging into the GUI
Execute the following on your system in the shell
ssh -L 5901:localhost:5901 cloud_user@<IP_ADDRESS>
use the pass word for cloud_user
Start a VNC client, and for the server address use localhost:5901.
The SLE Server will then load the GUI, and we can log into the desktop (with that same password) from there.
Click on Activities in the upper left of the screen.
Click on the Files icon (the blue file cabinet)
Click Documents on the left.
Click on the icon (in the upper right of this window) that looks like three horizontal lines.
Click the icon with a folder next to a
Enter a name like
my_dirand click Create.
Create a new tab in the window.Ctrl + T
With the right-hand Documents tab highlighted
Click on + Other Locations
Click on Computer
Right click on
Select Copy to….
Navigate to Documents and my_dir
Click the Select button in the top right of the window.
In that same right-hand tab, navigate again to + Other Locations, Computer, then usr -> share -> bash -> helpfiles.
Click on one, any one, and then drag it up to the left-hand tab and hover
The tab will turn green, and display that directory.
drag the file and put it in our