Warning: sem_get() [function.sem-get]: failed for key 0x152b: Permission denied in /home3/adminsky/public_html/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 98
AdminSky.org » CMD – Linux

Our Sponsors

Linux – cp

The following are some of the flags and arguments that can be used for the cp command:

 

-f, –force if an existing destination file cannot be opened, remove it and try again

-i, –interactive prompt before overwrite

-l, –link link files instead of copying.

-p same as –preserve=mode,ownership,timestamps

-R, -r, –recursive copy directories recursively

-s, –symbolic-link make symbolic links instead of copying

-u, –update copy only when the SOURCE file is newer than the destination file or when the destination file is missing

-v, –verbose explain what is being done

 

copy a file and preserve the file mode, ownership and timestamps, use cp with -p option.

 [root@linux ~]# cp -p /etc/passwd .

 

copy file in verbose mode.

 [root@linux test]# cp -v test.txt linux.txt

`test.txt’ -> `linux.txt’

 

create identical copy of directory (archive).

[root@linux test]# cp –a directory new_directory

 

create an soft link to a file in verbose mode

 [root@linux test]# cp -vs linux.txt linux-link.txt

`test.txt’ -> `link.txt’

Linux – more/less

More:

Display the contents of a specified file one screen at a time. Use the spacebar to move forward through the file a screen at a time; use the Enter key to move forward through the file one line at a time.

more myfile
Display the contents of the file myfile

Less:

These commands are almost the same, and usually act in a pipe. They are used for file pagination to terminal. Below are some example commands:

zcat /var/log/vmksummary.1.gz | less

more /etc/passwd

Linux – ls

LiSt files in a directory. -R makes it recursive, and -l shows more information on each item.

ls -lh       Long format human readable
ls -a       (List files in a directory including hidden, also known as dot files due to their prefix files.)
ls -dl */  (List directories in long format (does not display files). Could add as a shell alias, say lsd.)q
ls -clt     List

Linux – route

Modify or print routingtable

route                               Prints routing table
route del ?net default              Deletes the default gateway
route add ?net default gw 10.20.0.1 Adds a new default gateway

Linux – password

Changes the password for the userid entered as a parameter for the command. Only root can change the password for other users. They can only change their own password with command “passwd”. Userids are disabled by default. They are activated by setting a password for them. An example command for root to set a password is the following command:

passwd johndoe


Warning: sem_acquire(): supplied argument is not a valid SysV semaphore resource in /home3/adminsky/public_html/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 107

Warning: sem_release(): supplied argument is not a valid SysV semaphore resource in /home3/adminsky/public_html/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 116