Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Any interesting commands in Linux?

views
     
TSFlierMate
post Sep 28 2021, 10:17 PM, updated 3 months ago

On my way
****
Validating
515 posts

Joined: Nov 2020
Any interesting commands in Linux?

Let's start with me:

To display a pop-up notification message:
CODE
notify-send <message>


user posted image

To display CPU info, just dump the text file "cpuinfo":
CODE
cat /proc/cpuinfo


user posted image

Anymore, anyone?

For example, how do you display a message dialogbox using bash script?

This post has been edited by FlierMate: Sep 28 2021, 10:18 PM
TSFlierMate
post Oct 2 2021, 04:16 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
This is how I convert myself from non-privileged user to privileged user with "sudo" access.
Is this the recommended way to do it?

Reference: Chapter 1. GNU/Linux tutorials

Initially, in a newly installed Debian, I am not a privileged user.

CODE
boo@debian:~$ sudo -l
[sudo] password for boo:
Sorry, user boo may not run sudo on debian.


The "culprit" is the configuration file at /etc/sudoers

I could not change the ownership, as seen below, unless I access with "su"(superuser?) and change the ownership using "chown".
Then, I add myself to the /etc/sudoers configuration file.

CODE
boo@debian:/etc$ chown boo sudoers
chown: changing ownership of 'sudoers': Operation not permitted
boo@debian:/etc$ root
-bash: root: command not found
boo@debian:/etc$ su
Password:
root@debian:/etc# chown boo sudoers
root@debian:/etc# exit
exit
boo@debian:/etc$ ls -l sudoers
-r--r----- 1 boo root 669 Feb 27  2021 sudoers
boo@debian:/etc$ echo "boo  ALL=(ALL) ALL" >> /etc/sudoers
boo@debian:/etc$ sudo
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit
boo@debian:/etc$ echo "boo  ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers


But /etc/sudoers must be owned by "root" before I can run as "sudo", so I access with "su" and revert the ownership from myself to "root".

CODE
oo@debian:/etc$ sudo
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit
boo@debian:/etc$ su
Password:
root@debian:/etc# chown root /etc/sudoers
root@debian:/etc# exit
exit


Voila, now I can run as "sudo" privileged access.

CODE
oo@debian:/etc$ sudo whoami
root
boo@debian:/etc$ sudo apt-get update
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Fetched 39.4 kB in 6s (6,472 B/s)                                              
Reading package lists... Done



angch
post Oct 3 2021, 11:53 AM

On my way
****
Junior Member
559 posts

Joined: Jul 2006
Some newer non-standard ones we use these days:

ripgrep. Grep, but stupid fast.

tokei. Lines of code counter. Fast.

exa. Better ls

zstd. Because it's stupid fast and produces smaller files than gzip, uses all cores for compression (without changing output), can adapt compression to I/O speed.

wrk. Web bench. Good for quick sanity checks on performance.

jq. For pretty printing (mostly) JSON.

Others other folks use, but I don't

parallel. GNU Parallel, to run things in parallel, when lazy.

bat. Better cat, with syntax highlighting.

fd. Better find than find.

The usual ones not taught in LPI, etc:

tmux. screen. Pick one.

htop. Better top.

vmstat. Poor man's fast system perf diagnostics.

iotop. Ditto, but for I/O.

strace. To figure out which what's happening with that slow process.

xz. For extreme compression for archival.

open. Open the selected file or directory with configured program, based on MIME-type.

xdg-open. Like open, but with desktop programs.
CODE
xdg-open ~
to launch your file manager on home directory. Mix and match with `find` and other command lines for fun stuff.

Not a command, but
CODE
cd -
changes to your previous current (haha) directory.
CODE

cd ~/myproject
cd /usr/local/something
cd - # goes back to ~/myproject


curl. For low level command line http/https stuff.

wget. For when curl sucks, and you want wildcard support.
CODE
wget www.download.example.com/dir/{version,old}/package{00..99}.rpm
ftw.

strings. Poor man's CTF util.

file. When you want file magic to tell you what file it actually is.

Other misc stuff.

docker. Stupid heavy for some stuff, but some stuff is cleaner via docker, and docker-compose.

git. Even for your /etc/

wireguard. Better vpn than openvpn.

mc. minio. When you wanna run your own S3 object store. Very fun when combined with zstd


This post has been edited by angch: Oct 3 2021, 12:21 PM
angch
post Oct 3 2021, 12:04 PM

On my way
****
Junior Member
559 posts

Joined: Jul 2006
QUOTE(FlierMate @ Sep 28 2021, 10:17 PM)
For example, how do you display a message dialogbox using bash script?
*
apt-get install dialog
angch
post Oct 3 2021, 12:08 PM

On my way
****
Junior Member
559 posts

Joined: Jul 2006
QUOTE(FlierMate @ Oct 2 2021, 04:16 PM)
This is how I convert myself from non-privileged user to privileged user with "sudo" access.
Is this the recommended way to do it?
CODE

sudo usermod -a -G sudo newadminuser


Is how I promote a normal user to sudo user in Ubuntu. Should be same as debian's setup.

CODE

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL


That's because of the above rule by default in /etc/sudoers

This post has been edited by angch: Oct 3 2021, 12:09 PM
angch
post Oct 3 2021, 12:27 PM

On my way
****
Junior Member
559 posts

Joined: Jul 2006
Also, nice that you wrote your own, but we usually lazily just do

CODE

angch@rick:~$ od -A x -t x1z -v hello | head
000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00  >.ELF............<
000010 02 00 3e 00 01 00 00 00 a0 c1 45 00 00 00 00 00  >..>.......E.....<
000020 40 00 00 00 00 00 00 00 78 4e 12 00 00 00 00 00  >@.......xN......<
000030 00 00 00 00 40 00 38 00 07 00 40 00 0e 00 0d 00  >....@.8...@.....<
000040 06 00 00 00 04 00 00 00 40 00 00 00 00 00 00 00  >........@.......<
000050 40 00 40 00 00 00 00 00 40 00 40 00 00 00 00 00  >@.@.....@.@.....<
000060 88 01 00 00 00 00 00 00 88 01 00 00 00 00 00 00  >................<
000070 00 10 00 00 00 00 00 00 04 00 00 00 04 00 00 00  >................<
000080 9c 0f 00 00 00 00 00 00 9c 0f 40 00 00 00 00 00  >..........@.....<
000090 9c 0f 40 00 00 00 00 00 64 00 00 00 00 00 00 00  >..@.....d.......<

for hex dumps

CODE
alias hexdump="od -A x -t x1z -v"


And there's also https://github.com/sharkdp/hexyl which is now in Debian buster.

grep -> ripgrep
od -> hexyl

This post has been edited by angch: Oct 3 2021, 12:34 PM
TSFlierMate
post Oct 4 2021, 03:30 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
QUOTE(angch @ Oct 3 2021, 12:27 PM)
.......
*
Thank you, angch, for the great number of commands. I will keep this for reference.

Good to know you are a Linux enthusiast!
TSFlierMate
post Oct 4 2021, 03:34 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
QUOTE(angch @ Oct 3 2021, 12:08 PM)
CODE
sudo usermod -a -G sudo newadminuser


Is how I promote a normal user to sudo user in Ubuntu. Should be same as debian's setup.


*
Just want to comment on this one: My issue was, I can't use "sudo" as a non-privileged user, and I am the only user.

So , I end up with that solution. The other solution is go to recovery mode in boot menu, but I forgot the commands to type there.

Thank you, nevertheless. biggrin.gif
acbc
post Oct 4 2021, 03:34 PM

Look at all my stars!!
*******
Senior Member
7,889 posts

Joined: Jan 2003
Been scratching my head to get W7 or W10 to see my Ubuntu shares. Tried everything and none worked. Ubuntu can access Windows shares using the built-in Files app.
angch
post Oct 4 2021, 04:54 PM

On my way
****
Junior Member
559 posts

Joined: Jul 2006
QUOTE(FlierMate @ Oct 4 2021, 03:34 PM)
Just want to comment on this one: My issue was, I can't use "sudo" as a non-privileged user, and I am the only user.

So , I end up with that solution. The other solution is go to recovery mode in boot menu, but I forgot the commands to type there.

Thank you, nevertheless.  biggrin.gif
*
Can I see your
CODE
groups
output, from your only user?

Your installation probably has root logins allowed, and you should login as root to get your usual user access to
CODE
sudo


This post has been edited by angch: Oct 4 2021, 04:55 PM
anakkk
post Oct 4 2021, 04:55 PM

Regular
******
Senior Member
1,266 posts

Joined: Apr 2013
rm -rf
TSFlierMate
post Oct 4 2021, 05:42 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
QUOTE(angch @ Oct 4 2021, 04:54 PM)
Can I see your
CODE
groups
output, from your only user?

Your installation probably has root logins allowed, and you should login as root to get your usual user access to
CODE
sudo

*
Here it is:
user posted image

Anyway, I can run "sudo" now after typing the commands stated earlier.
TSFlierMate
post Oct 4 2021, 06:03 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
QUOTE(acbc @ Oct 4 2021, 03:34 PM)
Been scratching my head to get W7 or W10 to see my Ubuntu shares. Tried everything and none worked. Ubuntu can access Windows shares using the built-in Files app.
*
No idea. I know my previous Win 10 also could not see my Ubuntu files, but never bother figure how.

Anyone with solution to this?

QUOTE(anakkk @ Oct 4 2021, 04:55 PM)
rm -rf
*
It will recursively delete a directory and all its contents and forcibly delete files without asking.

Kool, but use with caution. thumbsup.gif
angch
post Oct 4 2021, 08:50 PM

On my way
****
Junior Member
559 posts

Joined: Jul 2006
More useful commands, sysadmin perspective.

dmidecode. Dump DMI (BIOS) information, for low level hardware info.

lsblk. List out your virtual and physical media. Very useful when you do fancy LVM, DM-RAID and/or bcache stuff.

lspci, lsmem, lslocks, lsof, lshw. All very useful lowlevel info.

convert, and the usual ImageMagick toolkit.

nmap, netstat. For debugging networking stuff.

ethr. For network benchmark when you don't wanna use iperf.

smartctl, hdparm. For drive management stuff.

fail2ban. For slowing down script kiddies.

This post has been edited by angch: Oct 4 2021, 08:54 PM
GOPI56
post Oct 4 2021, 09:13 PM

Regular
******
Senior Member
1,304 posts

Joined: Dec 2012
QUOTE(acbc @ Oct 4 2021, 01:34 AM)
Been scratching my head to get W7 or W10 to see my Ubuntu shares. Tried everything and none worked. Ubuntu can access Windows shares using the built-in Files app.
*
To do that, you will need to set up Samba on Ubuntu:



This post has been edited by GOPI56: Oct 4 2021, 09:14 PM
TSFlierMate
post Oct 14 2021, 05:50 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
In Linux, it is possible even to set sound volume through command in terminal window.

Increase :
CODE
$ amixer set Master 8%+


Decrease :
CODE
$ amixer set Master 8%-


user posted image

Found it online (Xah Lee's Linux tutorial).
TSFlierMate
post Oct 14 2021, 05:52 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
QUOTE(angch @ Oct 4 2021, 08:50 PM)
More useful commands, sysadmin perspective.
....
lspci, lsmem, lslocks, lsof, lshw. All very useful lowlevel info.

*
And "lscpu" too!

Which is almost identical to "cat /proc/cpuinfo"

Cheers!
angch
post Oct 15 2021, 04:25 PM

On my way
****
Junior Member
559 posts

Joined: Jul 2006
And if it isn't obvious yet:

asciinema. For when you're too lazy to document and "script" is too crappy.
TSFlierMate
post Oct 15 2021, 06:55 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
QUOTE(angch @ Oct 15 2021, 04:25 PM)
And if it isn't obvious yet:

asciinema. For when you're too lazy to document and "script" is too crappy.
*
Cool stuff! Thanks for introducing it.

Some examples of mine:
» Click to show Spoiler - click again to hide... «


This post has been edited by FlierMate: Oct 15 2021, 06:55 PM
ceciliatang95
post Oct 18 2021, 08:36 AM

Getting Started
**
Junior Member
67 posts

Joined: Oct 2021


Hi~

Thanks for the input here forumers.
I just started Linux myself, here are some useful ones:

CODE
df -h

For revealing disk space and usage, pretty useful if for server admins.
Make sure check out the /var/logs, majority of the legacy server at my company has /var/logs of 2GB

CODE
du -s

Check the file usage of your current folder

CODE
cd -

Change directory to your previous directory. Say if you were at /home/foo/bar and then cd to /var/log/audit, you can use cd - to instantly return to /home/foo/bar/

CODE
truncate -s (number) (size) (file)

Truncate a file size, useful if the Linux cannot even use rm -rf due to full disk space.
Sample: truncate -s 10k app.log

Hope it helps.
angch
post Oct 18 2021, 09:37 AM

On my way
****
Junior Member
559 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,869 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
559 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
559 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
559 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

TSFlierMate
post Nov 22 2022, 07:38 PM

On my way
****
Validating
515 posts

Joined: Nov 2020
QUOTE(d4n3sh @ Nov 11 2022, 05:26 PM)
CODE
sudo !!
is one I use alot. Every time I go duh! I forgot to sudo.

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

*
Thanks to danesh, learnt something new:
(double exclamation point) refers to the previous command; the command !! alone on an input line reruns the previous command.

 

Change to:
| Lo-Fi Version
0.0220sec    0.28    5 queries    GZIP Disabled
Time is now: 31st January 2023 - 08:55 AM