Linux Command Line Cheatsheet

Punniya seelan
0

 People always have the impression that GNU/Linux are difficult to use. Most people still think that GNU/Linux is just like DOS where you have to navigate by typing commands. The good thing is that most distros nowadays come with beautiful interface and applications, and you don’t really need to understand any command line to use Linux. On the other hand, having some knowledge of the command line can definitely make you more efficient and productivity. If you are one of those who will freak out when you are on the terminal, we have compiled a list of useful Linux commands that you can use to make your workflow more productive.

CommandDescription
File Commands
lsList the content of the current directory
ls -RList the subdirectories recursively
ls -aList all the content, including hidden files
ls -lList the content and its information
pwdOutput the current directory that you are in
cd folder1Change the working directory to folder1
cdReturn to the $Home directory
cd ..Go up a directory
cd -Return to the previous directory
cp source destinationCopy source to destination
cp -r source destinationCopy a folder recursively from source to destination
mv source destinationMove (or rename) a file from source to destination
rm file1Remove file1
rm -f file1Remove file1 without prompt
rm -r folderRemove a folder and its content recursively
mkdir foldernameCreate a new folder foldername
rmdir foldernameRemove an empty folder
file file1Show the file type of file1
cat file1 file2Concatenate file1 to file 2
cat > file1Concatenate standard input to file1
less file1View and paginate file1
head file1Show first 10 lines of file1
tail file1Show last 10 lines of file1
chmod 777 fileChange file permission of file to 777
chown user:group fileChange ownership of file to user and group group
ln -s source destinationCreate a symbolic link from source to destination

File Encryption and Compression
gpg -c fileEncrypt file
gpg file.gpgDecrypt file.gpg
tar -cf archive.tar foo barCreate archive.tar from files foo and bar
tar -xf archive.tarExtract all files from archive.tar.
gzip file1Compress file1 and rename it to file1.gz
gzip -d file1.gzDecompress file1.gz

System Commands
uname -aShow system and kernel
head -n1 /etc/issueShow distribution
mountShow mounted filesystems
dateShow system date
uptimeShow system uptime
whoamiShow your username
wDisplay who is online
man commandShow manual for command
!!Repeat the last command
exitLog out of current session

File Searching Commands
grep pattern filesSearch for pattern in files
grep -iCase insensitive search
grep -rRecursive search
grep -vInverted search
grep -oShow matched part of file only
locate file1Find file1
whereis commandFind binary/source/manual for command
which appLocate a command for the app
look string file1Display any lines in file1 which contain string as a prefix.

Process Management
psShow snapshot of processes
topShow real time processes
kill pidKill process with id pid
pkill nameKill process with name name
killall nameKill all processes with names beginning name

Disk Space
df -hShow free space on mounted filesystems
du -h folderShow file usage of each folder in folder
du -sh folderShow the total file size of folder
fdisk -lShow disks partitions sizes and types (run as root)
freeShow memory and swap usage
Tags:

Post a Comment

0Comments

Post a Comment (0)