SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Basic Linux commands
Almost These Linux commands are basics except those which relate to package
manager, we all know that they differs, Ubuntu, Mint ... use Apt, Arch uses Pacman ...
Here are some Basic Linux commands :
Display Linux distributor's ID
lsb_release -is
Display Linux release number
lsb_release -rs
Display Linux code name
lsb_release -cs
Display machine hardware name
uname -m
List all PCI devices, such as display card and ethernet card.
lspci
Reclaim memory which stores pagecache, dentries and inodes
echo 3 > /proc/sys/vm/drop_caches
Display a list of modules in the Linux Kernel
lsmod
List USB devices
lsusb -v
Display the status of ethernet card
sudo ethtool eth0
List hardware
sudo lshw
List harddisk partitions
sudo fdisk -l
Display SATA harddisk parameters
sudo hdparm -I /dev/sda
Display disk space usage
df -h
Display file/folder space usage
du -bsh FOLDER_NAME
Display amount of free and used memory
free
Display processes
ps -e
Display a tree of processes
pstree
Display processes dynamically
top
Terminate a process with a given process id
sudo kill -9 PROCESS_ID
Terminate all processes with a given name
sudo killall PROCESS_NAME

List files which are opened by a given process
lsof -p PROCESS_ID
lsof -c PROCESS_NAME
List processes which opened a given file
lsof FILE_NAME
List processes which are using port 80
lsof -i :80
Configure an ADSL connection
sudo pppoeconf
Starts up ADSL connections
sudo pon
Shuts down ADSL connections
sudo poff
Display MAC of a given IP address
arping IP_ADDRESS
Display NetBIOS name of a given IP address
nmblookup -A IP_ADDRESS
Display IP address and MAC
ifconfig -a
Display route
netstat -rn
Set MAC of ethernet interface
sudo ifconfig eth0 hw ether 00:11:22:33:44:55
Display information of a domain name
whois example.com
Display the network path to a given host
tracepath example.com
Request an IP address from DHCP server
sudo dhclient
Temporarily restart an init script
sudo /etc/init.d/SCRIPT_NAME restart
Temporarily stop an init script
sudo /etc/init.d/SCRIPT_NAME stop
Add a user
sudo adduser USER_NANE
Delete a user
sudo deluser USER_NAME
Change user password
sudo passwd USER_NAME
Changes user fullname, office number, office extension, and home phone number
information.
sudo chfn USER_NAME
Display user information
finger USER_NAME
Temporarily prevent a user from logging in
sudo usermod -L USER_NAME
Revoke the operation above
sudo usermod -U USER_NAME
Add a user to admin group
sudo usermod -G admin -a USER_NAME
Set the HTTP proxy
export http_proxy=http://PROXY.DOMAIN.NAME:PORT
Modify the information displayed after logging in
sudo vim /etc/motd.tail
Choose the input method for X Window
im-switch -c
Convert the file name from GBK to UTF8
convmv -r -f gbk -t utf8 --notest FILE_NAME
Convert the file content from GBK to UTF8
iconv -f gbk -t utf8 FILE_NAME
Convert tags in '*.mp3' from GBK to UTF8
find . -name '*.mp3' -execdir mid3iconv -e GBK {} ;
Read a long file
less FILE_NAME
Print lines matching a pattern
grep REG_EXP FILE_NAME
Display a list of file name. The files contain a given string.
grep -lr REG_EXP PATHNAME
Display all '.txt' file
find . -name '*.txt'
Create two empty files
touch file_name_1 file_name_2
Create directory. Create parent directories as needed.
mkdir -p /tmp/a/b/c/d/e
Change working directory to the home folder
cd
Change working directory to the previous working directory
cd Display hidden files
ls -a
Copy directory. Preserve links, file mode, ownership, timestamps.
cp -a SOURCE_DIRECTORY DEST_DIRECTORY
Determine file type
file FILE_NAME
Output the last 6 lines
tail -n 6 FILE_NAME
Copy files via SSH
scp -rp FILE_NAME USERNAME@HOST:DEST_PATH
Rename '*.rm' files to '*.rmvb' files
rename 's/.rm$/.rmvb/' *
Change the file name to lowercase
rename 'tr/A-Z/a-z/' *

Display subdirectories in current directory
ls -d */.
Display file number in current directory
ls . | wc -w
Extract "*.gz" file
gunzip FILE_NAME.gz
Extract "*.tar.gz" file
tar zxf FILE_NAME.tar.gz
Extract "*.tar.bz2" file
tar jxf FILE_NAME.tar.bz2
Do compression
tar czf FILE_NAME.tar.gz FILE1 FILE2 FILE3
tar cjf FILE_NAME.tar.bz2 FILE1 FILE2 FILE3
Displays a calendar
cal
cal MONTH YEAR
Set the date and time via NTP
sudo ntpdate ntp.ubuntu.com
Poweroff your computer
sudo halt
sudo shutdown -h now
Poweroff your computer in 23:00
sudo shutdown -h 23:00
Poweroff your computer after 60 minutes
sudo shutdown -h +60
Reboot your computer
sudo reboot
sudo shutdown -r now
If you want some program to start up automatically, please put '.desktop' files into
'$HOME/.config/autostart'
You can configure "preferred applications" by this file
"$HOME/.local/share/applications/mimeapps.list"
Continuously monitor the memory usage
watch -d free
Display HTTP HEAD response
w3m -dump_head http://example.com
Display file content with line number
nl FILE_NAME
Eliminate Rootkit
sudo rkhunter --checkall
Change hostname
sudo hostname new_name
"Tasksel" group software packages into "task"s. You can select a "task" and then install all
necessary software packages. It is easy to set up LAMP servers or cloud computing
servers.
Show all tasks
tasksel --list
Display the extended description of a task
tasksel --task-desc lamp-server
List the packages which are parts of a task
tasksel --task-packages lamp-server
Install/remove a task
gksudo tasksel
Change Process priority
renice NEW_PRIORITY `pgrep NAME_OF_PROCESS`
example: renice 5 `pgrep firefox`
renice -5 `pgrep wine-server`
high <------------------> low
NEW_PRIORITY = -19, -18, -17 [...] 18, 19, 20
Clear Bash history
history -c
If you want to use colorful "ls", that is, use colors to distinguish types of files, you can add
these lines in $HOME/.bashrc:
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
fi
$HOME/.thumbnails/ directory is a cache dir GNOME makes when you browse through
your folders in nautilus.
It contains thumbnail pictures of picture files you've previously looked at.
You can get its total size by
du -bs $HOME/.thumbnails/
You can delete the files in the .thumbnails directory that haven't been accessed for seven
days, to free disk space.
find $HOME/.thumbnails/ -type f -atime +7 -exec rm {} ;
Capture screen after 10 seconds
gnome-screenshot -d 10
Capture current window after 10 seconds
gnome-screenshot -wd 10
Start GConf editor:
Press Alt+F2, type 'gconf-editor'.
Set apt source
sudo software-properties-gtk
sudo software-properties-kde
Display the packages which are not installed but have remained residual config
dpkg -l | awk '/^rc/ {print $2}'
Add a PPA repository:
sudo add-apt-repository ppa:PPA-REPOSITORY-NAME
Display a list of files. The files are installed from a given package.
dpkg -L PACKAGE_NAME
Display a list of packages. The packages installed a given file.
dpkg -S FILE_NAME
Display a list of packages. The name of packages matches given regex pattern.
apt-cache search REG_EXPRESSION
Display a list of packages. The packages provide a given file.
apt-file search FILE_NAME
Display a list of packages. The given package depends on the list of packages.
apt-cache depends PACKAGE_NAME
Display a list of packages. These packages depend on the given package.
apt-cache rdepends PACKAGE_NAME
Prompt for a disk to be inserted and then add the disc to the source list.
sudo apt-cdrom add
Install the newest versions of all packages currently installed on the system.
sudo apt-get upgrade
Delete residual package configuration files.
dpkg -l | grep ^rc | awk '{print $2}' | sudo xargs dpkg -P
Automatically install necessary files for './configure ; make ; make install'
sudo auto-apt run ./configure
Save the list of packages currently installed on your system.
dpkg --get-selections | grep -v deinstall > SOME_FILE
Then use the file to restore packages.
dpkg --set-selections < SOME_FILE ; sudo dselect
After running "sudo apt-get install", "*.deb" files are stored in "/var/cache/apt/archives"
You can clean this directory by:
sudo apt-get clean
Display URL for a given package
apt-get -qq --print-uris install PACKAGE_NAME
Display some statistics about the apt cache
apt-cache stats
Display all package name
apt-cache pkgnames
Display some information of a given package
apt-cache show PACKAGE_NAME

Weitere ähnliche Inhalte

Was ist angesagt? (18)

Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guide
 
Linux
LinuxLinux
Linux
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Linux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersLinux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for Beginners
 
Presentation Linux Server setup Advance Networking
Presentation   Linux Server setup Advance NetworkingPresentation   Linux Server setup Advance Networking
Presentation Linux Server setup Advance Networking
 
Apache1.ppt
Apache1.pptApache1.ppt
Apache1.ppt
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manual
 
Useful linux-commands
Useful linux-commandsUseful linux-commands
Useful linux-commands
 
Linux command line cheatsheet
Linux command line cheatsheetLinux command line cheatsheet
Linux command line cheatsheet
 
BASIC COMMANDS OF LINUX
BASIC COMMANDS OF LINUXBASIC COMMANDS OF LINUX
BASIC COMMANDS OF LINUX
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 
Linux class 8 tar
Linux class 8   tar  Linux class 8   tar
Linux class 8 tar
 
Linux class 9 15 oct 2021-5
Linux class 9   15 oct 2021-5Linux class 9   15 oct 2021-5
Linux class 9 15 oct 2021-5
 
Unix cmd
Unix cmdUnix cmd
Unix cmd
 
Linux commands cheat sheet by linoxide.com
Linux commands cheat sheet by linoxide.comLinux commands cheat sheet by linoxide.com
Linux commands cheat sheet by linoxide.com
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0
 

Andere mochten auch

Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commandsJauhar Amir
 
Basic commands (linux)
Basic commands (linux)Basic commands (linux)
Basic commands (linux)Faysal Khan
 
Basic commands of linux By Adam
Basic commands of linux By Adam Basic commands of linux By Adam
Basic commands of linux By Adam Mohammed Adam
 
Hhs en02 windows_and_linux
Hhs en02 windows_and_linuxHhs en02 windows_and_linux
Hhs en02 windows_and_linuxShoaib Sheikh
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commandsNguyen Vinh
 
ntroduction to GNU/Linux Linux Installation and Basic Commands
ntroduction to GNU/Linux Linux Installation and Basic Commands ntroduction to GNU/Linux Linux Installation and Basic Commands
ntroduction to GNU/Linux Linux Installation and Basic Commands Jaganadh Gopinadhan
 
basic linux command (questions)
basic linux command (questions)basic linux command (questions)
basic linux command (questions)Sukhraj Singh
 
Basic command for linux
Basic command for linuxBasic command for linux
Basic command for linuxgt0ne
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commandsAniket Thakur
 
Quick Guide with Linux Command Line
Quick Guide with Linux Command LineQuick Guide with Linux Command Line
Quick Guide with Linux Command LineAnuchit Chalothorn
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commandsMohammad Rafiee
 
Basic Commands 1 By Thanigai
Basic Commands  1 By ThanigaiBasic Commands  1 By Thanigai
Basic Commands 1 By ThanigaiKanchilug
 
Anandha ganesh linux1.ppt
Anandha ganesh linux1.pptAnandha ganesh linux1.ppt
Anandha ganesh linux1.pptanandha ganesh
 

Andere mochten auch (20)

Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Basic commands (linux)
Basic commands (linux)Basic commands (linux)
Basic commands (linux)
 
Linex
LinexLinex
Linex
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
Basic commands of linux By Adam
Basic commands of linux By Adam Basic commands of linux By Adam
Basic commands of linux By Adam
 
Hhs en02 windows_and_linux
Hhs en02 windows_and_linuxHhs en02 windows_and_linux
Hhs en02 windows_and_linux
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
ntroduction to GNU/Linux Linux Installation and Basic Commands
ntroduction to GNU/Linux Linux Installation and Basic Commands ntroduction to GNU/Linux Linux Installation and Basic Commands
ntroduction to GNU/Linux Linux Installation and Basic Commands
 
Linux basic commands tutorial
Linux basic commands tutorialLinux basic commands tutorial
Linux basic commands tutorial
 
basic linux command (questions)
basic linux command (questions)basic linux command (questions)
basic linux command (questions)
 
Sahul
SahulSahul
Sahul
 
Basic command for linux
Basic command for linuxBasic command for linux
Basic command for linux
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Quick Guide with Linux Command Line
Quick Guide with Linux Command LineQuick Guide with Linux Command Line
Quick Guide with Linux Command Line
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commands
 
Basic Commands 1 By Thanigai
Basic Commands  1 By ThanigaiBasic Commands  1 By Thanigai
Basic Commands 1 By Thanigai
 
Anandha ganesh linux1.ppt
Anandha ganesh linux1.pptAnandha ganesh linux1.ppt
Anandha ganesh linux1.ppt
 
Linux syllabus
Linux syllabusLinux syllabus
Linux syllabus
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 

Ähnlich wie Basic linux commands

Ähnlich wie Basic linux commands (20)

The one page linux manual
The one page linux manualThe one page linux manual
The one page linux manual
 
The one page linux manual
The one page linux manualThe one page linux manual
The one page linux manual
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
 
Linux
Linux Linux
Linux
 
50 Most Frequently Used UNIX Linux Commands -hmftj
50 Most Frequently Used UNIX  Linux Commands -hmftj50 Most Frequently Used UNIX  Linux Commands -hmftj
50 Most Frequently Used UNIX Linux Commands -hmftj
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Rhel3
Rhel3Rhel3
Rhel3
 
Clase4 (consola linux)
Clase4 (consola linux)Clase4 (consola linux)
Clase4 (consola linux)
 
Really useful linux commands
Really useful linux commandsReally useful linux commands
Really useful linux commands
 
Linux
LinuxLinux
Linux
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command Reference
 
Introduction to linux day-3
Introduction to linux day-3Introduction to linux day-3
Introduction to linux day-3
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from github
 
Ultimate Unix Meetup Presentation
Ultimate Unix Meetup PresentationUltimate Unix Meetup Presentation
Ultimate Unix Meetup Presentation
 
List command linux fidora
List command linux fidoraList command linux fidora
List command linux fidora
 
Sahul
SahulSahul
Sahul
 

Kürzlich hochgeladen

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Basic linux commands

  • 1. Basic Linux commands Almost These Linux commands are basics except those which relate to package manager, we all know that they differs, Ubuntu, Mint ... use Apt, Arch uses Pacman ... Here are some Basic Linux commands : Display Linux distributor's ID lsb_release -is Display Linux release number lsb_release -rs Display Linux code name lsb_release -cs Display machine hardware name uname -m List all PCI devices, such as display card and ethernet card. lspci Reclaim memory which stores pagecache, dentries and inodes echo 3 > /proc/sys/vm/drop_caches Display a list of modules in the Linux Kernel lsmod List USB devices lsusb -v Display the status of ethernet card sudo ethtool eth0
  • 2. List hardware sudo lshw List harddisk partitions sudo fdisk -l Display SATA harddisk parameters sudo hdparm -I /dev/sda Display disk space usage df -h Display file/folder space usage du -bsh FOLDER_NAME Display amount of free and used memory free Display processes ps -e Display a tree of processes pstree Display processes dynamically top Terminate a process with a given process id sudo kill -9 PROCESS_ID Terminate all processes with a given name sudo killall PROCESS_NAME List files which are opened by a given process lsof -p PROCESS_ID lsof -c PROCESS_NAME List processes which opened a given file lsof FILE_NAME List processes which are using port 80 lsof -i :80 Configure an ADSL connection sudo pppoeconf Starts up ADSL connections sudo pon Shuts down ADSL connections sudo poff
  • 3. Display MAC of a given IP address arping IP_ADDRESS Display NetBIOS name of a given IP address nmblookup -A IP_ADDRESS Display IP address and MAC ifconfig -a Display route netstat -rn Set MAC of ethernet interface sudo ifconfig eth0 hw ether 00:11:22:33:44:55 Display information of a domain name whois example.com Display the network path to a given host tracepath example.com Request an IP address from DHCP server sudo dhclient Temporarily restart an init script sudo /etc/init.d/SCRIPT_NAME restart Temporarily stop an init script sudo /etc/init.d/SCRIPT_NAME stop Add a user sudo adduser USER_NANE Delete a user sudo deluser USER_NAME Change user password sudo passwd USER_NAME Changes user fullname, office number, office extension, and home phone number information. sudo chfn USER_NAME Display user information finger USER_NAME Temporarily prevent a user from logging in sudo usermod -L USER_NAME Revoke the operation above sudo usermod -U USER_NAME Add a user to admin group sudo usermod -G admin -a USER_NAME
  • 4. Set the HTTP proxy export http_proxy=http://PROXY.DOMAIN.NAME:PORT Modify the information displayed after logging in sudo vim /etc/motd.tail Choose the input method for X Window im-switch -c Convert the file name from GBK to UTF8 convmv -r -f gbk -t utf8 --notest FILE_NAME Convert the file content from GBK to UTF8 iconv -f gbk -t utf8 FILE_NAME Convert tags in '*.mp3' from GBK to UTF8 find . -name '*.mp3' -execdir mid3iconv -e GBK {} ; Read a long file less FILE_NAME Print lines matching a pattern grep REG_EXP FILE_NAME Display a list of file name. The files contain a given string. grep -lr REG_EXP PATHNAME Display all '.txt' file find . -name '*.txt' Create two empty files touch file_name_1 file_name_2 Create directory. Create parent directories as needed. mkdir -p /tmp/a/b/c/d/e Change working directory to the home folder cd Change working directory to the previous working directory cd Display hidden files ls -a Copy directory. Preserve links, file mode, ownership, timestamps. cp -a SOURCE_DIRECTORY DEST_DIRECTORY Determine file type file FILE_NAME Output the last 6 lines
  • 5. tail -n 6 FILE_NAME Copy files via SSH scp -rp FILE_NAME USERNAME@HOST:DEST_PATH Rename '*.rm' files to '*.rmvb' files rename 's/.rm$/.rmvb/' * Change the file name to lowercase rename 'tr/A-Z/a-z/' * Display subdirectories in current directory ls -d */. Display file number in current directory ls . | wc -w Extract "*.gz" file gunzip FILE_NAME.gz Extract "*.tar.gz" file tar zxf FILE_NAME.tar.gz Extract "*.tar.bz2" file tar jxf FILE_NAME.tar.bz2 Do compression tar czf FILE_NAME.tar.gz FILE1 FILE2 FILE3 tar cjf FILE_NAME.tar.bz2 FILE1 FILE2 FILE3 Displays a calendar cal cal MONTH YEAR Set the date and time via NTP sudo ntpdate ntp.ubuntu.com Poweroff your computer sudo halt sudo shutdown -h now Poweroff your computer in 23:00 sudo shutdown -h 23:00 Poweroff your computer after 60 minutes sudo shutdown -h +60 Reboot your computer sudo reboot sudo shutdown -r now If you want some program to start up automatically, please put '.desktop' files into
  • 6. '$HOME/.config/autostart' You can configure "preferred applications" by this file "$HOME/.local/share/applications/mimeapps.list" Continuously monitor the memory usage watch -d free Display HTTP HEAD response w3m -dump_head http://example.com Display file content with line number nl FILE_NAME Eliminate Rootkit sudo rkhunter --checkall Change hostname sudo hostname new_name "Tasksel" group software packages into "task"s. You can select a "task" and then install all necessary software packages. It is easy to set up LAMP servers or cloud computing servers. Show all tasks tasksel --list Display the extended description of a task tasksel --task-desc lamp-server List the packages which are parts of a task tasksel --task-packages lamp-server Install/remove a task gksudo tasksel Change Process priority renice NEW_PRIORITY `pgrep NAME_OF_PROCESS` example: renice 5 `pgrep firefox` renice -5 `pgrep wine-server` high <------------------> low NEW_PRIORITY = -19, -18, -17 [...] 18, 19, 20 Clear Bash history history -c If you want to use colorful "ls", that is, use colors to distinguish types of files, you can add these lines in $HOME/.bashrc: if [ "$TERM" != "dumb" ]; then eval "`dircolors -b`" alias ls='ls --color=auto' fi
  • 7. $HOME/.thumbnails/ directory is a cache dir GNOME makes when you browse through your folders in nautilus. It contains thumbnail pictures of picture files you've previously looked at. You can get its total size by du -bs $HOME/.thumbnails/ You can delete the files in the .thumbnails directory that haven't been accessed for seven days, to free disk space. find $HOME/.thumbnails/ -type f -atime +7 -exec rm {} ; Capture screen after 10 seconds gnome-screenshot -d 10 Capture current window after 10 seconds gnome-screenshot -wd 10 Start GConf editor: Press Alt+F2, type 'gconf-editor'. Set apt source sudo software-properties-gtk sudo software-properties-kde Display the packages which are not installed but have remained residual config dpkg -l | awk '/^rc/ {print $2}' Add a PPA repository: sudo add-apt-repository ppa:PPA-REPOSITORY-NAME Display a list of files. The files are installed from a given package. dpkg -L PACKAGE_NAME Display a list of packages. The packages installed a given file. dpkg -S FILE_NAME Display a list of packages. The name of packages matches given regex pattern. apt-cache search REG_EXPRESSION Display a list of packages. The packages provide a given file. apt-file search FILE_NAME Display a list of packages. The given package depends on the list of packages. apt-cache depends PACKAGE_NAME Display a list of packages. These packages depend on the given package. apt-cache rdepends PACKAGE_NAME Prompt for a disk to be inserted and then add the disc to the source list. sudo apt-cdrom add Install the newest versions of all packages currently installed on the system. sudo apt-get upgrade
  • 8. Delete residual package configuration files. dpkg -l | grep ^rc | awk '{print $2}' | sudo xargs dpkg -P Automatically install necessary files for './configure ; make ; make install' sudo auto-apt run ./configure Save the list of packages currently installed on your system. dpkg --get-selections | grep -v deinstall > SOME_FILE Then use the file to restore packages. dpkg --set-selections < SOME_FILE ; sudo dselect After running "sudo apt-get install", "*.deb" files are stored in "/var/cache/apt/archives" You can clean this directory by: sudo apt-get clean Display URL for a given package apt-get -qq --print-uris install PACKAGE_NAME Display some statistics about the apt cache apt-cache stats Display all package name apt-cache pkgnames Display some information of a given package apt-cache show PACKAGE_NAME