Linux is a free, most-used and open-source operating system based on the Linux kernel. First released in 199o’s by Linus Torvalds. Approximately 90% of the internet is powered by Linux servers. Basically, Linux command should run on a shell/Terminal. Shell is a program that receives commands from the user and gives it to the OS for processing and returns the output.
Learning Linux commands for managing systems can give you more speed and control over your workflow. Here is some Basic Linux commands for beginners.
Basic Linux Commands
- File Command: The file command determine how to view and working with linux files
ls - directory listing ls -al -formatted listing with hidden files ls -lh - list directory with readable file size cd dir - change directory to dir cd - change to home pwd - show current directory/print working directory mkdir dir - create directory dir rm file - delete file rm -r dir - delete directory dir rm -f file - force remove file rm -rf dir - remove directory dir cp file0 file1 - copy file0 to file1 mv file0 file1 - rename file0 to file1 ln -s file link - create symbolic link 'link' to file touch file - create or update file cat > file - place standard input into file more file - output the content of the file less file - output the content of the file head file - output first 10 line of file tail file - output last 10 line of file tail -f file - output contents of file as it grows
- System Information: The system information command help you to view linux system information
date - show current datetime cal - show this month's calender uptime - show uptime since last reboot w - display who is online whoami - who are you logged in as uname -a - show kernel configuration cat /proc/cpuinfo - show cpu information cat /proc/meminfo - show memory information man command - show manual for command df - show disk usages du - show directory space usages du -sh - human readable size in GB free - show memory and swap usages whereis app - show possiable locations of app which app - show which app will be run by default
- Searching: The searching command help you to search files on linux system
grep pattern file - search for pattern in file grep -r pattern dir - search recursively for pattern in dir command | grep pattern - search for pattern in the output of command locate file - find all instances of file grep -Ril 'dir' -e "text" - search text in all files in directory dir
- Process Management: The process management command help you to managing process of a linux system
ps - display currently active processes ps aux - ps with more details kill pid - kill process with pid 'pid' killall proc - kill all processes named proc bg - lists stopped/background jobs, resume stopped job in the background fg - brings most recent job to foreground fg n - brings job n to foreground
- File permission: The file permission command help you to setting files permission and ownership on linux system
chmod octal file - change permission of file chmod -R octal dir - changes permission of all fies in dir
4 – read(r)
2 – write(w)
eg chmod 777 – rwx for everyone
chmod 755 – rw for owner, rx for group/world
- Compression: The compression command help you to compress files using compression technique on linux system to save disk space.
tar cf file.tar files - tar files into file.tar tar xf file.tar - untar/extract into current directory tar tf file.tar - show contents of archive gzip file - compress fle and rename to file.gz gzip -d file.gz - decompress file.gz
c- create archive
t – table of contents
x – extract
f – specifile filename
z – use zip/gzip
j – bzip2 compression
k – do not overwrite
T – files from file
w -ask for confirmation
ctrl+c - halts corrent command ctrl+z - stops current command fg - resume stopped command in foreground bg - resume stopped command in background ctrl+d - logout of current session ctrl+w - erases one word in current line ctrl+u - erases whole line ctrl+r - reverse lookup of previous commands exit - lohout of current session
ssh [email protected] - connect to host as user on default ssh port ssh -p port [email protected] - connect using port p ssh -D port [email protected] - connect and using bind port ssh -i keyfile [email protected] - connect using ssh key file
./configure make make install
ping host - ping host 'host' whois domain - get whois data for domain dig domain - get DNS information for domain dig -x host reverse lookup host wget file_url - download file wget -c file_url - continue stopped download wget -r url - recursively download file from url
Linux/Windows System and SQL Server Database Administrator with more than 4.5 years of experience in Linux Servers administration, Windows Administration, Network Administration, SQL Server Administration, MySQL Administration and SQL Programming.