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.
Learning Objectives
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!
Use the
tree
command 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 runtree
with 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:tree /
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
less
: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
tree
output 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 thistree
command: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 thetree
output: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
- Launch your VNC client
- Copy the remote lab/playground server public IP address
- Enter the following on your VNC Server field:
Your_Public_IP:5901
- The SLE Server will then load the GUI, and we can log into the desktop using
cloud_user
and the password available under the lab credentials
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+
sign
Enter a name likemy_dir
and 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 onconfig.bootoptions
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 ourmy_dir
directory