Important Unix/Linux Commands

in #technology7 years ago

Linux is very important to me, so here's my way of sharing that with you. I've gathered a list of commands that are useful for anyone trying to get the most out of a Unix or Linux box.

What does the command dos2unix do?


“DOS/MAC to UNIX text file format converter … [a] program that converts plain text files in DOS/MAC format to UNIX format.”

What does the command unix2dos do?


“UNIX to DOS text file format converter … [a] program that converts text files in UNIX format to DOS format.”

Some commands are useful for system administrators when running scripts and programs. What are the following pair of commands useful for?


at and cron

  • at let’s you “Queue, examine or delete jobs for later execution … at … read[s] commands from standard input or a specified file which are to be executed at a later time.” Times are accepted in the form HH:MM.
  • cron is a daemon that’s used to “... execute scheduled commands”. Crontab files are loaded into memory and cron checks if it should be run in the current minute.

bg and fg

  • bg is a BASH_BUILTIN command. It “[resumes] each suspended job ‘jobspec’ in the background”.
  • fg is a BASH_BUILTIN command. It “[resumes] jobspec in the foreground, and make it in the current job …”

jobs and nice

  • jobs is a BASH_BUILTIN command. It allows for different ways to list running processes, their IDs, when they undergo changes and their general status.
  • nice allows the user to “... run a program with modified scheduling priority.” It “run[s] COMMAND with an adjusted niceness, which affects process scheduling. With no COMMAND, print the current niceness.” Niceness is measured from -20 to 19.

watch and dmesg

  • watch lets you “... execute a program periodically…” and displays the output of the periodically executed program. The program “... is run every 2 seconds …” by default.
  • dmesg “print[s] or control[s] the kernel ring buffer”. Effectively, it lets “users … print out their bootup messages …”.

What is a daemon (in terms of Unix/Linux jargon)?


A daemon is a program/process that runs in the background. It lurks invisibly while listening for service requests to respond/act accordingly.

What are 5 commonly used daemons? How are they usually named?


I used https://en.wikipedia.org/wiki/List_of_Unix_daemons as my source for these daemons and their descriptions, on top of checking corresponding man pages.

One can often identify a daemon if the program name ends with a ‘d’.

  • crond: “Time-based job scheduler …” that “run[s] jobs in the background.”
  • inetd: “Listens for network connection requests…” that “...launch a background daemon to handle the request…” that are also known as “...super servers...”
  • ftpd: A daemon that listens for “FTP requests from a remote system.”
  • sshd: A daemon that listens for SSH requests from remote systems.
  • syncd: A daemon that “... keeps the file systems synchronized with system memory.”

Now some examples: What would be the result of the following commands?


chmod 775 masterfile
Changes permissions of file with name ‘masterfile’ to read, write and execute for owner and owner group. But only read and write for others.

chmod go+rx myfile
Changes permissions of file with name ‘myfile’ to add read and execute permissions for the owner group and others.

who > textfile
Writes output of who command into file with name ‘textfile’, while overwriting the current content of ‘textfile’. who outputs current logged in users, the time when they logged in and the address they connected from.

ln Masterfile file
Makes link named ‘file’ to a file named ‘Masterfile’. Commands that use ‘file’ will act as if they used ‘Masterfile’.

ps - f
“Full format listing…” of ps command. When I ran it in my shell it gave two processes, their UID, PID, PPID, C, STIME, TTY, TIME and CMD.

Quoted text was taken directly from the man pages


Image Source


Visit my Steemit profile for more prose, philosophy essays and tutorials. If you want to know what I'm up to check out my portfolio.

Sort:  

Very useful article. Thanks. Resteemed.

this was a very informative article, i am currently learning linux and this helped me a lot.

Glad I could help!

Thanks for sharing. I figured I was at least one of a few Steemets using Linux. I use Mint, what about you?

Ubuntu based distros mostly but I've played with arch a bit too. Hope you enjoyed the read

Oh yeah, most definitely did. Thinking about venturing into the Linux administrator world.

great article martin-stuessy check my posts on unix too!