#Commands for linux

28 messages · Page 1 of 1 (latest)

tribal wedge
#

I'm new to Linux so can whoever sees this send me some of the most used and most useful commands for linux by you?

Thanks

#

And also say what those commands do please

tame mason
#

Also, a cool tip i learned recently is that if you type !! it will repeat the last command.

So for example, if you tried running apt update and forgot to put sudo, the command wont work. So you can just type sudo !! and it will be as if you wrote sudo apt update

There are variations of this trick with slightly different syntax but this is the most simple form of it

mint osprey
#

or multiple times if looking for an older past-run command

#

another good one is autocomplete. eg: if a file is named abcdefghijk lmn opqr.xyz and you want to copy it to ~/Documents... then just be in the prompt in the folder where the long file is, the cp abcd(hit tab key now) ~/Doc(hit tab key again) <enter>

tame mason
mint osprey
#

yes. and?

tame mason
#

!! is quicker

mint osprey
#

up arrow, Home

tame mason
#

True 😅

mint osprey
#

as in, press Home key

#

are you saying !! puts cursor at line start?

#
  • pwd if you're not sure what folder you're in
tame mason
mint osprey
#

give an example please.

mint osprey
#

commands you can experiment with @tribal wedge (type it, then a space, then --help after, and press enter (eg: uname --help) man is manual. (eg: man uname)

ls
ls -l
lsblk
lsblk -f
lsblk -o name,type,model,label,size,fstype,fsused,fsavail,mountpoint

free -h
cat
more
sync
parted
pushd
popd
cp
mkdir
rm
mv < use extremely accurately, or don't at all. move doubles as rename depending on syntax!
top
up arrow, home, end keys
ctrl-shift-c (copy highlighted text) ; ctrl-shift-v (for paste in terminal )
date
cal
ls -l --group-directories-first
inxi (and its variants with -b, -F, etc)
uname -a
uname -r
lsb_release -a

#

rfkill list or rfkill --output-all (see if wifi or bluetooth is switched off by software setting or hard switch)

#

cat /proc/swaps (see if swap is in play, how much, and where)

#

note: pushd main useful goal is like to jump to a folder you tell it explicitly, instead of using cd
popd (no added options, just pops back to previous directory your were in)

#

pwd
cd
cd ..
cd /
cd ~ or cd with nothing else (return to userhome)

mint osprey
#

uptime
clear
watch -n 1 sensors
htop , neofetch (external programs)
apt search -vpackage name or approximate package name

#

apt list -i (show all installed native apps, literally all)

#

apt list -ivpackage name or partial name followed by an askterisk (list with detail, stuff installed that matches package name or partial name with asterisk)

#

nano (external program, text editor)

mint osprey
#

sudo reboot