Solved

some linux command questions

Posted on 2004-04-15
8
319 Views
Last Modified: 2010-04-20
pls can someone help me to understand some of the next command questions
tks very much


question 1:
cat /etc/passwd
ljespers:x:502:503:lotte_jespers:/users/lotte:/bin/bash
kjespers:x:503:504:karel_jespers:/users/karel:/bin/bash

what does the :x: means
what does the 502:503 out of the ljespers line mean
the /bin/bash <= does this indicated the startup directory or ....

question 2:
ls -la
drwxr-x---    3 kjespers testgroup     4096 Apr 11 08:30 .kde
-rwxrwxrwx    1 kjespers testgroup      231 Apr 11 12:42 test

what is the meaning off the first charcater of each line
d
and
-

question 3:
kill -9 2932
process with id 2932 is killed
what does this -9 means

question 4:
use of the alias command
alias = RM = 'rm-i'
??
0
Comment
Question by:karel_jespers
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 6

Assisted Solution

by:karlwilbur
karlwilbur earned 350 total points
ID: 10834556
"what does the :x: means"
Usually the password is stored here but an "x" means somehting elas. The "x" is a place holder. It indicates that shadow passwords are being used and the users password in found in the /etc/shadow file.

"what is the meaning off the first charcater of each line 'd' and '-'"
The "d" means that it is a directory and "-" meand that it's not a directory

"what does this -9 means"
the "-9" indicates a signel to be sent to the process rather that the default "TERM" signal
Some of the more commonly used signals:
     1           HUP (hang up)
     2           INT (interrupt)
     3           QUIT (quit)
     6           ABRT (abort)
     9           KILL (non-catchable, non-ignorable kill)
     14           ALRM (alarm clock)
     15           TERM (software termination signal)
see man kill

"use of the alias command"
alias sets a string of characters to execute a command:
like:
alias youdienow = 'kill -9'
would make so that "kill -9 httpd" would execute if you typed "youdienow httpd".

Does this answer your questions?
0
 
LVL 12

Expert Comment

by:stefan73
ID: 10834557
Hi karel_jespers,
> what does the :x: means
The password is shadowed in /etc/shadow against dictionary attacks.

2.
>what is the meaning off the first charcater of each line d and -
d=directory. - = ordinary file. There are other special flags, such as s for suid.

3. Part of Unix interprocess communication are signals. kill sends a signal to a process. -9 or -SIGKILL is a signal to kill a process. A SIGKILL cannot be caught or avoided, it always immediately kills a process. Other signals include SIGTERM (kill's default signal) and error signals, such as SIGSEGV, which indicates a memory access error.

do "man kill" in the shell to see what kill is about.

4. Aliases are "shorthand" for command sequences, or to give default parameters to a command. Example (bash/ksh):
alias ll='ls -ltr'
So when you type "ll" you'll get "ls -ltr" instead. Saves typing :-)

Cheers,
Stefan
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 10834590
1) long ago the password was encoded in place of the x,
now it is hidden in the /etc/shadow file
The idea was that passwords could no longer be read and re-calculted on super computers.

2) d for directory, - for ordinary file (there's more than that!)

3)  kill sends a SIGNAL to a process,  default = 15 (easy termination) , 9 = stop immediately.


;JOOP!
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 24

Expert Comment

by:sciuriware
ID: 10834604
I'm too slow in typing ......
;JOOP!
0
 
LVL 40

Accepted Solution

by:
jlevie earned 50 total points
ID: 10834640
(1) The "x" is a place holder for the password field and indicates that the real password will be found in /etc/shadow. "502:503" is the UID and GID, respectively for that account. /bin/bash if the login shell for that user. The complete definition of a line from the passwd file is:

login-name : password : UID : GID : Gecos/Full Name : home-dir     : login shell
ljespers        :         x        : 502 : 503 : lotte_jespers         : /users/lotte : /bin/bash

(2) The first character of the perms field of a long directory listing can be one of:

-    no special attributes
d   indicates a directory
l    symbolic link
s    socket
b   block special file
c    character special file

(3) 'kill -9 some-pid' says to send the process specified a SIGKILL signal. SIGKILL is sort of a "terminate with extreme prejudice" and is the last resort short of a reboot in killing a process. The preferred method is to use 'kill some-pid' which sends a SIGQUIT signal. That allows the process to go through any shutdown processing that it might ordinarily need to do. A SIGKILL may not allow that.

(4) The alias "RM='rm -i'" sets up a command substition so that when a user execute 'RM some-file' the actual command executed becomes 'rm -i some-file', which does an interactive delete (see 'man rm' for details).
0
 
LVL 12

Expert Comment

by:stefan73
ID: 10834646
sciuriware,
> I'm too slow in typing ......
Ask me about it ;)

Stefan
0
 
LVL 6

Expert Comment

by:karlwilbur
ID: 10834692
WOW! What a response.  I think that we've managed to really answer this question.

karel_jespers,

Do you get it now?  Any more questions? If so, feel free to ask. As you can see there are a lot of people waiting to help.

-Karl
0
 
LVL 6

Author Comment

by:karel_jespers
ID: 10834795
tks a lot
linux people are GREAT !
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question