#Commands for linux
28 messages · Page 1 of 1 (latest)
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
or just hit the up arrow once. what can be simpler than that?
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>
But then you need to scroll the cursor back to the beginning of the string to add sudo before the command
yes. and?
!! is quicker
up arrow, Home
True 😅
as in, press Home key
are you saying !! puts cursor at line start?
pwdif you're not sure what folder you're in
No. That you can type 'sudo !!'
give an example please.
.
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)
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)
sudo reboot