Useful Linux Commands-2

Files

CommandDescription
ls -laLists files

l: Use a long listing format

a: List all entries including those starting with a dot

pwdDisplays working directory
rmis used to delete files. When used recursively, it may be used to delete directories.
rm -rRemoves directories and their contents recursively.
rm -fIgnores nonexistent files, and never prompt before removing.
rm -rfforces the directory to delete
cpis makes copies of files and directories.
cp -rCopıes directories recursively.
mvmoves, or renames, files and directories on your filesystem.
ln -sCreates a symbolic link
touchis also an easy way to create empty files.
catreads data from files, and outputs their contents.
moreis a filter for paging through text one screen at a time.
headDisplays first 10 lines of the file content
tailDisplays the last 10 lines of the contents of the file
tail -fDisplays the last 10 lines of the contents of the file in real time

 

Processes

CommandDescription
psReports a snapshot of the status of currently running processes.
ps auxgives output with all options implemented
pmap -x PIDGives the memory map of the process
topThe top commands provide a dynamic real-time view of a running system. It can display system summary information, as well as a list of processes or threads currently being managed by the kernel.
killKills a process
killallkills all processes
pkill -f telnetfinishes the process
bgis a job control command that resumes suspended jobs while keeping them running in the background.
fgresume the most recently suspended or backgrounded job.

 

Permissions

CommandDescription
  
chattr +ifiles cannot be deleted but untouchable
chattr -iremoves untouchable
chattr +aPreserves existing rows, allowing rows to be added to the bottom.
lsattrChecks if the chattr command is valid
chmod 777everything can be read, written and executed.
chmod 644read-only
chmod 755only the owner reads, writes and executable.
chown owner-userchanges the owner of the file
chown owner-user:owner-groupchanges the owner and group of the file
chown -Rgives the user access with its directories