Skip to content

rodrigosistemas/linux_server_commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 

Repository files navigation

# Linux Commands

## File and Directory Management

### List Available Commands
```bash
ls /usr/bin

Tux Penguin

Count Number of Commands

ls /usr/bin | wc -l

echo

Print to screen

echo

pwd

Print the current directory

pwd

ls

List files or existing directories

ls
  • List all files, including hidden ones
    ls -a
  • List in long format
    ls -l

cd

Change directory

cd

cp

Copy a directory

cp

mv

Move or rename a directory or folder

mv

mkdir

Create a directory

mkdir

rmdir

Remove a directory

rmdir

rm

Remove a file

rm

Force delete

rm -rf

touch

Create a file

touch

less

Provide more information about the file

less

cat

Concatenate (create, merge, and print files to the screen)

cat

tail

Show the last 10 lines of a file

tail

head

Show the first 10 lines of a file

head

which

Ask for the path of a directory's binary

which

alias

View the entire list of aliases

alias

locate

Is used to quickly find files on the system, and it also uses a database

locate file

Update batabase

sudo updatedb

find

Real-time search by traversing the file system

find /file/route -name file

System Information

hostname

System host name

hostname

whoami

Current user of the system

whoami

grep

Search for the given word inside a file

grep

du

Check the space of a file inside a directory

du
  • In Bytes, Kilobytes, Megabytes
    du -h

Default Login Shell

grep username /etc/passwd

Package Management

List installed packages with apt

apt list --installed

Search for programs in repositories

sudo apt-cache search <package>

List installed programs using dpkg

dpkg-query -l
dpkg -l

Show information about a package

sudo apt-cache show <package>

apt-get remove

Remove installed programs

apt-get remove <package>

sudo apt-get purge

Remove all data of the programs

sudo apt-get purge <package>

sudo apt-get autoremove

Clean up some program logs

sudo apt-get autoremove

dpkg

Tool for installing, copying, deleting, and manipulating packages

dpkg

wget

Useful for obtaining content from the web, compatible with HTTPS, HTTP, and FTP protocols

wget <url>

Environment Variables

Verify the PATH directory to execute a file

echo $PATH

Show the shell language

echo $LANG

Print environment variables used in the session

env

System Updates and Administrator Permissions

sudo apt-get update

Check for updates

sudo apt-get update

sudo apt-get upgrade

Update all programs to their latest versions and install system updates easily

sudo apt-get upgrade

sudo su

Activate administrator mode

sudo su

Change user password

passwd

Changing permissions (numbers)

chmod 777 file
chmod 755 file
chmod 644 file
chmod 000 file

Changing permissions (letters)

chmod u+x file
chmod g-w file
chmod o+r file

exit

Exit administrator mode

exit

Create a backup

sudo apt install timeshift
sudo timeshift --create --comments ""
sudo timeshift --restore
timeshift --list
sudo timeshift --restore --snapshot ID
sudo timeshift --delete --snapshot ID

Reboot

reboot
init 6

File Compression and Decompression

Compress files

tar -cvf archive.tar.gz /directory
  • -c: Create a new archive
  • -v: Show what is being archived
  • -f: Specify the filename of the tar archive

Decompress files

tar -xvf archive.tar.gz /directory
  • -x: Extract the tar archive
  • -v: Show what is being extracted
  • -f: Specify the filename of the tar archive

List the content of a tar archive

tar -tf archive.tar.gz

Miscellaneous Commands

apt moo

Show a hidden message

apt moo

neofetch

Display system information

neofetch

cmatrix

Show a matrix animation in the terminal

cmatrix

sensors

Show the temperature of the processor and GPU

sensors

htop

Show system processes in an interactive interface

top
htop

figlet

Create ASCII art text

figlet

About

General commands for linux administration

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published