Useful Linux Commands

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Message
Author
User avatar
limotux
Posts: 186
Joined: Tue Jul 27, 2021 9:24 am

Useful Linux Commands

#1 Post by limotux »

Hi,

As you can see at viewtopic.php?f=6&t=66692&p=655927#p655927 I ahve been distro hopping over the past few months, tried some distros, whether "normal" Linux distros (RPM, DEB), Arch, and even BSD.
To me it was a great experience and I have learnt a lot.

The main thing I learnt is that the command line (yes, this black screen that many users shy away from), is the most powerful tool in Linux. It does magic.

So, out of caring about sharing my experience I thought of making this thread, where in the nect post I will put a few Linux commands that I found useful, helpful and powerful.

Just a little hint, some Linux commands require root privilege (i.e. adding "sudo" without quotes before the command then it will ask you your root password, then will do the command.) Some others may run in the background (the prompt will disappear, to exit you will need CTL-X)

A final thought, if you are searching over the internet, you might find some asking you to create or edit a file, many of them say do the command:

Code: Select all

vi xyz.txt
where "vi" is a command line text editor. (I didn't really like it) so, I installed "nano", which is a text editor that suited "my taste" more.

In a while I will start in the next post to put some of the commands that can benefit all of us, especially newbies whom I care about more.
Just for convenience I will add/edit the next post so that everything will be in one single post not scattered.

Of course, any users can post the commands they think are useful to add, so I add them to the main post (err... the second one)

I hope it will be useful.
Last edited by limotux on Thu Oct 07, 2021 8:57 am, edited 1 time in total.
MX-23.3_KDE_x64 Libretto May 19 2024, Kernel: 6.1.0-23-amd64 x86_64, KDE Plasma -Init: SysVinit - quad core Intel Core i7 - SSD: Samsung SSD 250GB, Memory: 7.51 GiB
I am not techie. Installed 13 Jun, 2024

User avatar
limotux
Posts: 186
Joined: Tue Jul 27, 2021 9:24 am

Re: Useful Linux Commands

#2 Post by limotux »

Details of machine and hardware.

Code: Select all

inxi -F
More Details of machine and hardware

Code: Select all

inxi -Fxxx
Know the file system and partitions

Code: Select all

df
All disks and filesystem in hierarchical tree

Code: Select all

lsblk
Details and List of files in the current directory

Code: Select all

ll
thanks to rokytnji.1 memberlist.php?mode=viewprofile&u=17058

Code: Select all

 balooctl status
See what baloo is doing now

Code: Select all

 balooctl status
Force baloo to search for non-indexed files and index it:

Code: Select all

 balooctl check
In case you feel something wrong and want to delete the index (it will automatically rebuild index)

Code: Select all

balooctl purge
Change "swappiness" (the lower the better in general, and I see MX Developers did a perfect thing here as I found my default =15, so no need to really change it)

Code: Select all

sudo sysctl vm.swappiness=10
To know current Sawappiness

Code: Select all

sudo sysctl vm.swappiness
Check if there are updates:

Code: Select all

sudo apt-get update
Then if there are update available

Code: Select all

sudo apt-get upgrade
OR
combine both in one

Code: Select all

sudo apt-get update && sudo apt-get upgrade
Test Hard Drive Health
https://linuxconfig.org/how-to-check-an ... g-smartctl

To start the test, wait till the time it tells then run other commands

Code: Select all

$ sudo smartctl -l error -l selftest /dev/sda
Generate Report and notice the table at the beginning

Code: Select all

sudo smartctl -a /dev/sda

Code: Select all

sudo smartctl -H /dev/sda
To know if a system is systemd or init

Code: Select all

ps --no-headers -o comm 1

Code: Select all

init --version
Last edited by limotux on Tue Mar 08, 2022 11:39 am, edited 7 times in total.
MX-23.3_KDE_x64 Libretto May 19 2024, Kernel: 6.1.0-23-amd64 x86_64, KDE Plasma -Init: SysVinit - quad core Intel Core i7 - SSD: Samsung SSD 250GB, Memory: 7.51 GiB
I am not techie. Installed 13 Jun, 2024

User avatar
rokytnji.1
Global Moderator
Posts: 839
Joined: Sun Apr 13, 2014 9:06 pm

Re: Useful Linux Commands

#3 Post by rokytnji.1 »

Here are simple tricks
https://itsfoss.com/linux-command-tricks/

l start with something really obvious and yet really important: tab completion.

When you are starting to type something in Linux terminal, you can hit the tab key and it will suggest all the possible options that start with string you have typed so far.

For example, if you are trying to copy a file named my_best_file_1.txt, you can just type ‘cp m’ and hit tab to see the possible options.

Post Reply

Return to “Tips & Tricks by users (not for help)”