Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Useful Terminal Commands.
#11
(09-28-2018, 10:01 PM)rick forges Wrote: echo $PATH | sed "s,:,\n,g"   works in terminal but not when assigned to an alias
had to remove the single quote in front of echo

what am I missing ?

btw I used
alias path=echo $PATH | sed "s,:,\n,g"

Try the following:
Code:
alias path='echo $PATH | sed "s,:,\n,g"'

You have to quote the command because an alias is effectively a veriable in bash.
My website - My git repos

"Things are only impossible until they’re not." - Captain Jean-Luc Picard
Reply
#12
(09-02-2018, 02:13 AM)bob777 Wrote: Over the last two years I've collected some very useful Commands that I’d like
to share...that you can run in the Terminal...these Commands will not harm
your System...please feel free to add more.

Graphics card Information...   inxi -SGxx

CPU Info...   lscpu

What OS are you using...  inxi -S

Mint desktop environment...  inxi -Szxx

Firewall Status...   sudo ufw status verbose

How much HDD space is available?     inxi -po

If you'd like to free up drive space, a useful and safe command
is...  sudo apt-get clean

Hard drive Info...type...  lsblk

This terminal command will show your Ram hardware and
configuration...   sudo inxi -m

Version of Linux Mint...  inxi -Sz

CPU Usage...  cpufreq-info 

Hard Drive Temp...  sudo hddtemp /dev/sd?

Computer Information...   inxi -Fxzd   
  
  Core Temperatures type in Terminal...   sensors

System info...   sudo lshw > lshw.txt

Graphics card Information...   inxi -Sgxx

Show DNS Being Used...  sudo nmcli dev show | grep DNS

Flush DNS in Linux Mint...   sudo /etc/init.d/dns-clean start

How Much Ram do I Have...   free -m

What Kernel Version Do I Have...   uname -r

What Wine Version...     wine  --version
Thank you bob777 you are now my new god. boy I have been looking for a list like this for a long time. Thank you
Reply
#13
Install neofetch to pull quick system information and impress your friends.

Install for Deb based systems:
sudo apt install neofetch

Run:
neofetch

Friends now think you are a l33t H4x0r
Reply
#14
(03-23-2019, 09:47 AM)Cthulhu Wrote: Install neofetch to pull quick system information and impress your friends.

Install for Deb based systems:
sudo apt install neofetch

Run:
neofetch

Friends now think you are a l33t H4x0r

neofetch pairs well with 'lolcat':

Code:
neofetch | lolcat
My website - My git repos

"Things are only impossible until they’re not." - Captain Jean-Luc Picard
Reply
#15
(09-26-2018, 04:34 PM)LIFE.LinuxIsForEveryone Wrote:
(09-02-2018, 02:13 AM)bob777 Wrote: Over the last two years I've collected some very useful Commands that I’d like
to share...that you can run in the Terminal...these Commands will not harm
your System...please feel free to add more.

Graphics card Information...   inxi -SGxx

CPU Info...   lscpu

What OS are you using...  inxi -S

Computer Information...   inxi -Fxzd   

System info...   sudo lshw > lshw.txt

How Much Ram do I Have...   free -m

What Kernel Version Do I Have...   uname -r
Great post bob777! There's some of these I'l definitely notate and use going forward, and there's some that I already use a different variation of. 

*** A quick heads-up; many Distros (to my dismay) do not come with inxi out of the box. For any Ubuntu based Distro, first run $ sudo apt install inxi -yy ***

Examples of what I use that are similar to some of the above I quoted:
$ inxi -F
$ inxi -F |less
$ inxi -F > inxi.txt
(Be sure to use a CAPITAL "F" - it makes a difference)
--- I like to use this because it shows me EVERYTHING! The CPU, GPU, RAM, System, the whole nine yards. Granted some people may like smaller chunks, but I prefer this [one] command to view everything I want to know at one time

$ uname -a
--- More verbose than uname -r is all; again shows a bit more info

$ free -h
$ free -m
$ free -g
--- All essentially do the same thing, but I've gotten used to using -h [human readable] because if there are <1GB it auto-magically shows MB's, and if >1GB it shows the amount in GB's

A couple extras which are add-ons to commands:
-yy
&&

Anytime I run updates, install programs via terminal, and so on, I've gotten to always adding "-yy" after the command; Yes, some say "that's risky" because it tells the system to enter "YES" to any prompts that would normally come up, however, I make sure I know what I'm intending to install ahead of time. If it's something new that's I've never installed on a specific Distro before, or something I've never installed before at all, then I forego that part of the command. Otherwise, it's a nice time-saver to only have to enter in one command.

EXAMPLE: sudo apt dist-upgrade -yy


Whenever I install updates, or need to run multiple commands (FYI this is not needed for multiple program installs in-line), I use "&&" in between the commands. 

EXAMPLE: sudo apt update && sudo apt dist-upgrade -yy
--- This isn't needed for programs, as a user can simply space the programs out:$ sudo apt install inxi htop 


There's more of course, and I'm by NO means super-advanced, but I can finally hold my own with many commands from memory, vs just a year ago having to pretty much check the man page or web search everything. 

Cheers!

""Examples of what I use that are similar to some of the above I quoted:
$ inxi -F
$ inxi -F |less
$ inxi -F > inxi.txt
(Be sure to use a CAPITAL "F" - it makes a difference)
--- I like to use this because it shows me EVERYTHING! The CPU, GPU, RAM, System, the whole nine yards. Granted some people may like smaller chunks, but I prefer this [one] command to view everything I want to know at one time.""
#############################################################################

Hello LIFE.LinuxIsForEveryone,

That is some good stuff there for sure...

I noticed output issues on my system. On this command,

Code:
inxi -F |less 
and this command,

Code:
inxi -F >inxi.txt

both seem to interject the ASCI characters for the colors (I think) in the output. (At least for me)


So mine is like this for a clean output that is very readable...
Code:
inxi -F -c0 -Fxzd >inxi.txt

That takes the unwanted characters out of the output and it is readable....
I have this in a script I pieced together to do just what you said you use it for. I need to know what things are...LOL
Of course that is not the way I do the output, I use a "variable" of "$HOSTNAME" to set the output file to "System-name.info"

Here is the piece I use at the end of the script:
Code:
 

echo -e "File created: $today\n"
inxi -c0 -Fxzd
} >> "$infofile"
#
# Display the file to the screen
#
 cat "$infofile"
#
# Finished Section
#
echo
echo " :>" "Here You Go "$USER"!!" "I Found The Data You Requested"
echo
echo " :>" "Here Is The Data For "$HOSTNAME"'s"" System Information You Wanted....."
echo " :>" "Thank You For Using Your Hal-9000 Computer"
echo " :>" "Goodbye Bruce!"
echo "=============="
exit

Of course there is more to this... This is the part that pertains to the post...

It may not be the best code in the world but it works for me and does what I want...  Wink
I am no coder by no means and have been on linux for almost two years and I poke at everything
to see how it works..... Yep! I break stuff too.. That's what XBT is for.... Lol

I thought the "HAL- 9000" part was neat...

Thanks again for the post.... Later!
**********************************************************
Taglines of the Day:
Today is the tomorrow you worried about yesterday.  Huh 

Everybody remember where we parked. - Kirk

To Boldly Go Where No BBS Has Gone Before. USS Stargazer BBS, Sheridan In.
Reply
#16
I've collected quite a few snippets like this over the years. Here's a particular favorite of mine that doesn't just list out your PATH variable, but also allows you to add a directory to the PATH by passing it an argument. 


Code:
path () 

    local tmp="${1%/}";
    if [[ -n "${tmp}" ]] && [[ -d "${tmp}" ]]; then
        if ! grep -a --color=always -q "${tmp}" <<< ${PATH}; then
            PATH="${tmp}:$PATH";
        fi;
    fi;
    echo "$PATH" | tr ':' '\n'
}

Note, this doesn't save the new directory, so the path you add will just be there for the current terminal session. But it's handy for testing.

It also makes sure you aren't adding a duplicate directory to your PATH. A common problem I've fought over the years with PATH creep Smile
Should there be smoke coming from my CPU??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)