diff --git a/ls/ex-1_ls.adoc b/ls/ex-1_ls.adoc index 3ad6121..77b7748 100644 --- a/ls/ex-1_ls.adoc +++ b/ls/ex-1_ls.adoc @@ -208,7 +208,7 @@ NOTE: grep "string" path/to/file === find and grep command together -find . -name "*.conf" -exec grep -Hns "conf" {} \; +find /etc -name "*.conf" -exec grep -Hns "conf" {} \; .Explanation @@ -216,40 +216,90 @@ find . -name "*.conf" -exec grep -Hns "conf" {} \; ---- -H, --with-filename Print the filename for each match - -n, --line-number +-n, --line-number Prefix each line of output with the 1-based line number within its input file -s, --no-messages Suppress error messages about nonexistent or unreadable files. ---- -== Find IP +== Managing software + +=== APT + +WHAT IS APT? + +A packaging system simply provides programs and applications for installation. + +APT(Advanced Package Tool) is a command line tool that is the most efficient and preferred way of managing software from the command line for Debian and Debian based Linux distributions like Ubuntu . It manages dependencies effectively, maintains large configuration files and properly handles upgrades and downgrades to ensure system stability. + + +==== Updating Package Database + +Before commencing any operations with apt, we need to ensure that our local copy of the database is up-to-date. +Without this the system won’t know if there are newer packages available or not. [source,bash] ---- -# ifconfig - -eth0: flags=4163 mtu 1500 - inet 172.21.0.2 netmask 255.255.0.0 broadcast 172.21.255.255 - ether 02:42:ac:15:00:02 txqueuelen 0 (Ethernet) - RX packets 61 bytes 9309 (9.3 KB) - RX errors 0 dropped 0 overruns 0 frame 0 - TX packets 0 bytes 0 (0.0 B) - TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 - -lo: flags=73 mtu 65536 - inet 127.0.0.1 netmask 255.0.0.0 - loop txqueuelen 1000 (Local Loopback) - RX packets 248 bytes 14260 (14.2 KB) - RX errors 0 dropped 0 overruns 0 frame 0 - TX packets 248 bytes 14260 (14.2 KB) - TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +apt-get update ---- -TIP: inet ***172.21.0.2*** netmask 255.255.0.0 broadcast 172.21.255.255 +==== Upgrading Package Database + +Once your package database has been updated, you can now upgrade the packages with updates installed on you machine. This will update any applications, and the Ubuntu core system to the latest versions available. + +[source,bash] +---- +sudo apt-get upgrade +---- + + +==== SEARCH FOR PACKAGES WITH APT +To search for a package you can use the following command: + +[source,bash] +---- +apt search apache2 +---- + +==== INSTALLING NEW PACKAGES + +If you are find the name of the package you want to install, you can install it by running this command: + +[source,bash] +---- +apt install apache2 vlc +---- + + +==== REMOVING INSTALLED PACKAGES + +To uninstall a package from your system, you can use the following command: + +[source,bash] +---- +apt remove vlc +---- + +NOTE: This command removes the package but keeps the configuration files. So in case you reinstall the same package, your configuration remains the same. If you want to remove both the package and its associated configuration files, you can run this command: + +[source,bash] +---- +apt purge vlc +---- + +==== clean up any unused libraries and packages + + + +[source,bash] +---- +apt autoremove +---- +This command automatically removes any packages that aren’t used or associated with any installed program. It’s a great way to clean up any unused libraries and packages you don’t need. :hardbreaks: