Tag Archives: Command

Navigating the Linux File System

Mastering navigating the Linux file system will fasten access specific file or folder. If the Linux OS come with GUI then you got no issue navigating using interface but if the Linux OS is minimal version then navigate using CLI is a must.

First you need to know directory parent and children. Example as below:

Type of DirectoryExample
Parent/home/hadiyahyalab
Children/home/hadiyahyalab/Downloads

Listing the Contents of a Directory with ls

The ls command lists the contents of the current directory.

Below show the lists content of home directory.

To show hidden files, use below command.

To include details such as the file/folder permissions, owner and group, size and the date and time, enter the following command:

Here the explanation of the listing newfile.txt

ParameterExplanation
Filetype“-“rw-r–r– (refer to files)

Additional info:
“d”rwxr-xr-x (refer to directory/folder)
Permissionsrw-r–r–
Link Count1
OwnerHadi
GroupHadi
Filesize6
Last access date/timeMac 26 09:54
Filenamenewfile.txt

Another useful command as below:

  • ls -R

As you can see the command scans and lists all the contents. The information can be lengthy but you can simplify by redirect the output to a text file. Example as below:

And here the output from the homedir.txt, I using command less for me go through page by page or line by line.

Changing Directories with cd

Use the cd command to move within the file system from one directory to another.

Example:

I do a ls command to show available directory. I want to change directory to Pictures, so I use command cd Pictures. You can see the change on my CLI view.

To move up to parent directory use the below command.

To return to home directory use the below command.

Another command below also help you to return to home directory.

Finding Your Current Directory with pwd

Use pwd to check the current directory you have access.

Day-to-Day APT Usage

APT stand for Advanced Package Tool. APT also the first system to properly handle dependencies in software. If you want to install software like Libre Office, APT downloads Libre Office package and any other software it needs to work. APT also handles installation resuming if the internet connection is lose.

APT UPDATE & APT UPGRADE

APT uses a local cache of the available packages. Run the command below:

  • sudo apt update

As you can see APT will communicate with all the servers it is configured to use and download the latest list of file updates. If the list outdated, it will download the updates.

Next we can ask APT to automatically download any software that have been updated. Run the command below:

  • sudo apt upgrade

Below result the system already upgraded.

If the system is not upgrade, there will be a number of package that need to upgrade. It will show the download size of the package.

Remember, apt upgrade never removes software or adds new software!

If “0 not upgraded” status change, some things cannot be upgraded because of the update list didn’t satisfy the dependencies. In resolve this situation, we need to use apt dist-upgrade this allow to upgrade from one version of Debian/Ubuntu to a newer version.

APT INSTALL

This action is responsible for adding new software. For example, if I want to install MySQL database server. Here example command:

  • sudo apt install mysql-server

The output of the command tells:

  • All the dependencies required to install MySQL Server
  • There version that will install is MySQL-Server-8.0
  • There also suggested packages that can be install
  • Size the will be occupied on disk.

If the software/packages already installed, the apt install will be consider it as apt update and looks to see whether new versions are available for download.

APT REMOVE

The action is to remove the things that no longer want. The command as below:

  • sudo apt remove

Warning! Removing packages can be dangerous because APT also removes any software that relies on the packages that selected. Make sure to read the output carefully before proceed press Y to continue with the uninstall.

After the remove complete, the configuration files of the program is leave behind. If you reinstall, you don’t need to reconfigure it.

If want to remove the configuration file during the remove action, use below command:

  • sudo apt purge firefox

As you can see there is additional action perform by purge command. It will purging configuration files once the firefox is removed.

.::End of post::.