Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Any interesting commands in Linux?

views
     
angch
post Oct 18 2021, 09:37 AM

On my way
****
Junior Member
560 posts

Joined: Jul 2006
QUOTE(ceciliatang95 @ Oct 18 2021, 08:36 AM)
Make sure check out the /var/logs, majority of the legacy server at my company has /var/logs of 2GB

*
... logrotate, plz, kthxbye.


TruboXL
post Nov 5 2021, 02:31 PM

Budget HPC Hobbyist
*****
Junior Member
889 posts

Joined: Jan 2016


command -v

is better than

which
failed.hashcheck
post Nov 12 2021, 08:17 PM

Neighborhood plant pathologist
******
Senior Member
1,870 posts

Joined: Aug 2009
From: Shithole Klang
fish

The day i discovered and chsh to fish was the day my productivity instantly jumped by 200%

This post has been edited by failed.hashcheck: Nov 12 2021, 08:17 PM
lan76
post Dec 11 2021, 02:45 PM

Casual
***
Junior Member
314 posts

Joined: Sep 2006
From: KL



Do search on 'Top 10 Linux Command' biggrin.gif
TSFlierMate
post Jan 28 2022, 09:51 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
Learn ANSI escape code for coloring!!!

256-color terminal window: https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit

Example command to type in Linux bash shell: (Notice the -e switch)
CODE
$ echo -e "\e[48:5:40mThis was fun"


user posted image

The rules are:
CODE
ESC[38:5:⟨n⟩m Select foreground color      
ESC[48:5:⟨n⟩m Select background color

where n is a number from the table below

TSFlierMate
post Feb 16 2022, 04:59 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
Recently, I reinstalled my PC with Windows 10. And one strange difference where I notice, "Audacious" MP3 player in Debian 11, its music is poorly played if compared to "Groove Music" MP3 player in Windows 10.

This "Groove Music" in Windows 10 has better sound effect when playing MP3 songs than "Audacious" in Debian 11.
I thought every music player is the same, looks like I am wrong.
flashang
post Feb 19 2022, 10:51 AM

Getting Started
**
Junior Member
175 posts

Joined: Aug 2021


QUOTE(FlierMate @ Feb 16 2022, 04:59 PM)
Recently, I reinstalled my PC with Windows 10. And one strange difference where I notice, "Audacious" MP3 player in Debian 11, its music is poorly played if compared to "Groove Music" MP3 player in Windows 10.

This "Groove Music" in Windows 10 has better sound effect when playing MP3 songs than "Audacious" in Debian 11.
I thought every music player is the same, looks like I am wrong.
*
Different browser (even different version) perform differently.
Different programming language target different situation.
So it also applied to media player.

There is no one size fit all solution.

P/S : One of my favorites media player is vlc, which used lua language for extensions.

smile.gif


FlierMate1
post Jul 16 2022, 02:28 PM

Getting Started
**
Validating
139 posts

Joined: Jun 2022
Recently someone teaches me to use "find" command.

Code

$ find /usr/lib -name 'python*'
/usr/lib/python3.8
/usr/lib/python3.9
/usr/lib/valgrind/python3.supp
/usr/lib/python3
/usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/python.cpython-38.pyc
/usr/lib/python3/dist-packages/sos/report/plugins/python.py
/usr/lib/python3/dist-packages/twisted/python
/usr/lib/python3/dist-packages/python_apt-2.0.0+ubuntu0.20.4.7.egg-info
/usr/lib/python3/dist-packages/python_debian-0.1.36ubuntu1.egg-info
/usr/lib/python2.7
$


The "find" command to search for a filename pattern in all subdirectories:
CODE
find /usr/lib -name 'python*'


----

Actually "locate" command is more powerful, but you need to install it separately:
CODE
sudo apt install mlocate


Then, just type "locate" command followed by the filename you want to search, no need to define directory name, it will search the entire drive:
CODE
locate python




This post has been edited by FlierMate1: Jul 16 2022, 08:09 PM
angch
post Jul 17 2022, 09:17 PM

On my way
****
Junior Member
560 posts

Joined: Jul 2006
QUOTE(angch @ Oct 3 2021, 11:53 AM)
fd. Better find than find.
https://github.com/sharkdp/fd

CODE

angch@server:~$ time find . -iname "*.pdf"  >/dev/null
real    0m2.442s
user    0m0.945s
sys     0m1.489s
angch@server:~$ time fdfind '.pdf$'  >/dev/null
real    0m0.202s
user    0m1.788s
sys     0m2.093s


fd is *much* faster, without indexing. Colour coded too.

And fd's -exec runs the commands in parallel, no need to pipe to GNU parallel.

On Ubuntu:
CODE
sudo apt install fd-find


This post has been edited by angch: Jul 17 2022, 09:21 PM
FlierMate1
post Jul 19 2022, 08:06 PM

Getting Started
**
Validating
139 posts

Joined: Jun 2022
I have a question regarding "install" command.

Actually both lines are same, but then why there is "install" command?

CODE

$ install myapp /usr/local/bin


CODE

$ cp myapp /usr/local/bin


I do not quite understand. Any help?
angch
post Jul 19 2022, 09:45 PM

On my way
****
Junior Member
560 posts

Joined: Jul 2006
It's a legacy GNU coreutils thing.

Just ignore and use
CODE
cp
like everyone.

Use
CODE
man install
to rtfm the difference.

This post has been edited by angch: Jul 19 2022, 09:46 PM
FlierMate1
post Jul 19 2022, 10:45 PM

Getting Started
**
Validating
139 posts

Joined: Jun 2022
QUOTE(angch @ Jul 19 2022, 09:45 PM)
It's a legacy GNU coreutils thing.

Just ignore and use
CODE
cp
like everyone.

Use
CODE
man install
to rtfm the difference.
*
Thank you for the explanation.
TruboXL
post Jul 23 2022, 02:23 PM

Budget HPC Hobbyist
*****
Junior Member
889 posts

Joined: Jan 2016


QUOTE(FlierMate1 @ Jul 19 2022, 08:06 PM)
I have a question regarding "install" command.

Actually both lines are same, but then why there is "install" command?

CODE

$ install myapp /usr/local/bin


CODE

$ cp myapp /usr/local/bin


I do not quite understand. Any help?
*
as a package maintainer,
"install" can function like "mkdir -p", "cp -r", "chmod some-permission" in one line

dont think "cp" alone can do that...
togekiss
post Aug 2 2022, 11:40 AM

New Member
*
Junior Member
42 posts

Joined: Jul 2022
interesting...
jacklsw86
post Aug 5 2022, 02:22 PM

LYN spirit
******
Senior Member
1,604 posts

Joined: Jun 2006


ripgrep 'rg'. Faster than normal grep
FlierMateI
post Sep 6 2022, 04:08 PM

New Member
*
Validating
12 posts

Joined: Sep 2022
I always like the idea of listing detailed info about current directory, with file size and file attributes and all that, but I always find I cannot use "ll" command on Debian 11 / 10. I have no choice, to use "ls -l" instead which is longer to type.

CODE
boo@debian:~/Downloads$ ll
bash: ll: command not found
boo@debian:~/Downloads$ ls -l
total 768
-rw-r--r-- 1 boo boo    124 Jul 24 20:50 1.txt
-rw-r--r-- 1 boo boo     63 Jul 24 21:00 2.txt
-rw-r--r-- 1 boo boo     61 Jul 24 21:04 3.txt
-rw-r--r-- 1 boo boo    280 Aug 11 16:55 4.txt
-rw-r--r-- 1 boo boo     85 Aug 18 18:12 5.txt
-rw-r--r-- 1 boo boo     22 Sep  6 15:52 6.txt
-rw-r--r-- 1 boo boo 742478 Sep  2 22:54 earth.avi


But on WSL (Ubuntu 20.04), I can use "ll" command without problem.

CODE
boo@IdeaPad3:/mnt/c/Users/bookh/Downloads$ ll
total 4493144
drwxrwxrwx 1 boo boo       4096 Sep  6 15:53  ./
drwxrwxrwx 1 boo boo       4096 Jul 11 04:17  ../
-rwxrwxrwx 1 boo boo     151980 Sep  6 15:53 'Screenshot 2022-09-06 155320.png'*
-r-xr-xr-x 1 boo boo 4600823808 Jun 30 15:17  Windows.iso*
-rwxrwxrwx 1 boo boo        282 May 18 14:16  desktop.ini*


Does anyone know why?
15cm
post Sep 6 2022, 04:18 PM

Getting Started
**
Junior Member
178 posts

Joined: Apr 2022

QUOTE(FlierMateI @ Sep 6 2022, 04:08 PM)
I always like the idea of listing detailed info about current directory, with file size and file attributes and all that, but I always find I cannot use "ll" command on Debian 11 / 10. I have no choice, to use "ls -l" instead which is longer to type.

CODE
boo@debian:~/Downloads$ ll
bash: ll: command not found
boo@debian:~/Downloads$ ls -l
total 768
-rw-r--r-- 1 boo boo    124 Jul 24 20:50 1.txt
-rw-r--r-- 1 boo boo     63 Jul 24 21:00 2.txt
-rw-r--r-- 1 boo boo     61 Jul 24 21:04 3.txt
-rw-r--r-- 1 boo boo    280 Aug 11 16:55 4.txt
-rw-r--r-- 1 boo boo     85 Aug 18 18:12 5.txt
-rw-r--r-- 1 boo boo     22 Sep  6 15:52 6.txt
-rw-r--r-- 1 boo boo 742478 Sep  2 22:54 earth.avi


But on WSL (Ubuntu 20.04), I can use "ll" command without problem.

CODE
boo@IdeaPad3:/mnt/c/Users/bookh/Downloads$ ll
total 4493144
drwxrwxrwx 1 boo boo       4096 Sep  6 15:53  ./
drwxrwxrwx 1 boo boo       4096 Jul 11 04:17  ../
-rwxrwxrwx 1 boo boo     151980 Sep  6 15:53 'Screenshot 2022-09-06 155320.png'*
-r-xr-xr-x 1 boo boo 4600823808 Jun 30 15:17  Windows.iso*
-rwxrwxrwx 1 boo boo        282 May 18 14:16  desktop.ini*


Does anyone know why?
*
jesus, new account again?

angch
post Sep 6 2022, 05:57 PM

On my way
****
Junior Member
560 posts

Joined: Jul 2006
Alien Life Form? ALF?

CODE
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'


https://gist.github.com/marioBonales/1637696
boo1977
post Oct 10 2022, 04:59 PM

New Member
*
Validating
17 posts

Joined: Jul 2022
The following common Linux terminal commands are for students especially those playing with Raspberry Pi OS.

QUOTE
sudo = "put this in front of any commands, execute that particular commands as a 'SuperUser' (root)"

cd = "Change Directory (Folder)"

ls = "List all files and folders in current directory"

mkdir = "Create a new folder in current directory"

rm and rmdir = "Delete files and Delete folders"

wget = "Download anything from the internet using source links"

nano = "Use a built-in text editor Nano to display and edit any text files"


Taken from Cytron tutorial.
d4n3sh
post Nov 11 2022, 05:26 PM

Getting Started
**
Junior Member
87 posts

Joined: Dec 2008
From: Houston, TX


CODE
sudo !!
is one I use alot. Every time I go duh! I forgot to sudo.

CODE
❯ whoami
user1
❯ sudo !!
❯ sudo whoami
Password:
root


3 Pages < 1 2 3 >Top
 

Change to:
| Lo-Fi Version
0.0148sec    0.16    5 queries    GZIP Disabled
Time is now: 4th February 2023 - 01:10 AM