Basic Linux Commands


Ø File Handling Linux Commands

# man command (show all information about this command) 
# pwd  -- show current working directory
# cd     -- change current directory
# ls      -- list files or directory
# ls -a -- show hidden file or directory
# ls -lrt   -- show directory/file with ownership
# ls -al (show all directory include hidden directory with property like size, ownership etc.)
# mkdir test   -- create a directory name is test
# rm -rf test   -- remove test directory
# rm f1  -- remove f1 
# rm -rf d1 -- remove directory
# mv file1 file2 -- rename file1 to file2
# mv test.txt /root/test/  -- move test.txt file to /root/test directory
# cp source destination --copy source to destination directory
# less file --show file content 
# cat > hello.txt (Create file and input from keybord)
# history --show recently used command

  
Ø Check the Linux Version, Release name & Kernel version

# uname -a (Print all Information)
# uname -r (Print the kernel name)
# cat /p
# roc/version
# cat /etc/issue
# cat /etc/redhat-release
# lsb_release –a
# tail /etc/redhat-release


Ø Check Swap Space

# swapon –summary (summary of swap space)
# cat /proc/swaps (swap usage information)
# free -h (display use and free swap space in gigabyte)
# top (use to check swap space)

  
Ø Linux System Administrator
   
# uptime 
# uptime -v 
# w 
# users 
# who 
# who -b 
# who -r 
# who -a 
#  crontab -l 
# service httpd start(execute the script)
# top 
# last 
# ps -ef | grep init (show init process only)
# kill- 9 7508(Process ID) (kill command to terminate process)
# reboot (restart the system)
# init 6 (restart the system)


Ø File System

# cat output.log | less or more (view file)
# whoami 
# locate text.txt 
# sort file.txt
# sort -r file.txt 
# vi /etc/test.txt (text editor)
# free 
# free -h 
# grep test /etc/passwd (grep search for a given string in a file)
# grep -i serachstring /etc/passwd (grep search for a given string in a file)
# find / -name test (used to search files, strings and directories)
# lsof -u erpdev (List of all open files by user erpdev)


Ø Archival

# tar -cvf archive-name.tar /home (tar command is used to compress files and folders)
# tar -xvf archive-name.tar (extract tar archive file)
# zip original.zip original (zip original file)
# unzip original.zip ( unzip original.zip file)


Ø Network

# ssh -v (check the version of ssh user)
# ssh remote_host (you connect to a remote host)
# scp (Copy files securely and remotely over servers)
# ftp 192.168.50.2 (used to connect to remote ftp host)
# sftp 192.168.50.2 (sftp is secure file transfer protocol)
# ftp > mput *.txt (Putting multiple files in remote host)
# ftp > mget *.txt (mget to download multiple files from remote host)

              
            

Post a Comment

1 Comments

3