Linux Terminal Commands

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

uname -a – Show kernel information

cat /proc/cpuinfo – CPU information


cat /proc/meminfo – Memory information
df -h – Show disk usage
chmod octal file – Change the permissions of file to octal, which can be found separately for user,
group, and world by adding: 4 – read (r), 2 – write (w), 1 – execute (x)
Examples:
chmod 777 – read, write, execute for all
chmod 755 – rwx for owner, rx for group and world
ls – Directory listing
cd dir – Change directory to dir
cd – Change to home
mkdir dir – Create a directory dir
rm name – Remove a file or directory called name
rm -r dir – Delete directory dir
cp file1 file2 – Copy file1 to file2
cp -r dir1 dir2 – Copy dir1 to dir2; create dir2 if it doesn't exist
cp file /home/dirname – Copy the filename called file to the /home/dirname directory
mv file /home/dirname – Move the file called filename to the /home/dirname directory
mv file1 file2 – Rename or move file1 to file2; if file2 is an existing directory, moves file1 into
directory file2
mv /home/user/my_static /home/user/static … rename file

mv file1.ext file2.ext … rename file in Home directory

ln -s file link – Create symbolic link link to file

wget file – Download file


wget -c file – Continue a stopped download

sudo apt-get install <program> install program (Ubuntu, Mint, Debian)

sudo apt-get remove <program> uninstall a program (Ubuntu, Mint, Debian}

sudo apt-get --purge remove <program> (Ubuntu, Mint, Debian)

sudo apt-get autoremove (Ubuntu, Mint, Debian)

sudo apt-get update (Ubuntu, Mint, Debian)


sudo pacman -Syu update sistema (Manjaro, Arch)
sudo pacman -Syy update repozitorijuma (Manjaro, Arch)
sudo pacman -S (package name) instaliranje paketa (Manjaro, Arch)

sudo pacman -R (package name) deinstaliranje paketa (Manjaro, Arch)


sudo pacman -Rs (package name) potpuno deinstaliranje (Manjaro, Arch)

lscpu informacije o procesoru (Manjaro, Arch)

fdisk -l partitions (Manjaro, Arch)


cat /etc/lsb-release Release info (Manjaro, Arch)

reboot restart

poweroff isključivanje računara

ip a ip addr ip address (Manjaro, Arch)

ifconfig ip address (Mint, Ubuntu)

cfdisk is a program for partitioning any hard disk drive

Compression

tar cf file.tar files – Create a tar named file.tar containing files


tar xf file.tar – Extract the files from file.tar
tar czf file.tar.gz files – Create a tar with Gzip compression
tar xzf file.tar.gz – Extract a tar using Gzip
tar cjf file.tar.bz2 – Create a tar with Bzip2 compression
tar xjf file.tar.bz2 – Extract a tar using Bzip2
gzip file – Compresses file and renames it to file.gz
gzip -d file.gz – Decompresses file.gz back to file

xdg-open /home/mishek/Documents/citati.docx – open a file


Manjaro

Viewing and Removing Orphans

To list all orphans, installed packages that are not used by


anything else and should no longer be needed:

pacman -Qdt

To remove all the orphans:

sudo pacman -Rs $(pacman -Qdtq)

Cleaning the Cache

When pacman installs packages, it keeps a copy of all the old


packages you have downloaded. This cache can be very useful if you
have to install older packages in an emergency. However, left
unchecked, this cache will grow very large over time. Systems
running Pamac will already have access to its automated pacman
cache cleaning functions. It is also possible to clean them
manually using pacman.

To clear the cache of packages that are no longer installed, enter the following command:
sudo pacman -Sc

Otherwise, to clear the cache completely, enter the following


command (and use with care):

sudo pacman -Scc

A safer way to remove old package cache files is to remove all


packages except for the latest three package versions using
paccache:

paccache -rvk3

You might also like