sleed Posted February 2, 2014 Report Posted February 2, 2014 Hi there.I post essentialy 30 commands , that are used by everyone who work with linux : clearThis is the command to clear screen. When you work with Linux you have a great amount of possibility of trying loads of commands. This means you need to clean up the screen time and again so that you could focus on your desired job. In order to clear the mess you need the command of clear wherein you simply have to type ‘clear’ over the command prompt to see things clean over your screen. This command is also useful when you have to type long commands, which can confuse the users to see different details over the screen.lsShows list of files and directories.This is probably one of the most commonly typed commands. This has many options to see different types of files and it also supports wild cards. Show all files in current directory ls Show all files in a directory /mydir/some/path ls /mydir/some/path Display details of all file in the list ls -l Display all hidden files as well (including the files name start with a do ) ls -a Display all file that have names starting with my ls my*cdUsed to change directory Go to the home directory of logged in user cd Go to a specific directory named /mydir/some/path cd /mydire/some/pathcpCopy a file or directory from one location to another. Copy a file name file1 with name file2 cp file1 file2 Copy the directory name dir1 to dir2 cp -r dir1 dir2mkdirCreate one or more directories Create a directory named mydirecory mkdir mydirectory Create 3 directories name dir1, dir2 and dir3 mkdir dir1 dir2 dir3manUsed to read more details about how to use any commandThere are hundreds of commands and each of these commands are supported with dozens of options. You can always use this command to explore more options supported by a command. Show help for ls command man ls Show help for grep command man grepmv - Rename commandUsed for renaming a file or directory.Rename file1 to file2mv file1 file2System InformationdateThe command to see current date or set system date/timeIn order to type the date in two digit month formats, two digit time formats, two digit date, two digit minutes, you need this command. This will in changing and setting the date and time over your Linux based computer. This command is very much useful when you want to log on being a root. Display current date date Set current system date to "June 20, 1985, 5:27 PM" date 0620172785dfThe command for checking available disc spaceThe computer users are often known to check the availability and consumed memory space over their systems for both the Linux and Windows desktop PCs. You can easily check the amount of memory available over the disk at your Linux system by simply typing the command of DF. It helps in offering you the status of file system disk space over your Linux based system.df -hduDisplay disk space use by each file in the file system Display disk usage by each file in Documents directory du -h Documents Display disk usage by the whole Documents direcotry du – sh DocumentstopDisplay the top running processes on the system with memory and cpu utilization. Display all top running processes top Display all top running processes from user fromdev top -U fromdevpsShow the status of running processes Display all running process status for current user ps Display the list of all running processes on system with their status. ps -alunameFind information about version and details of operating systemuname -aFile OperationsgzipThis command will compress a file in gzip format.gzip file1gunzipUncompress the gzip file.gunzip file1.gztailDisplay last few lines contents of a file. Very useful to watch latest content updates on log file. Watch running content of a logfile name logfile1 tail -f logfile1 Display last 100 lines of a file name myfile tail -100 myfilescpCopy a file to or from a remote hostCopy the file "myfile.txt" from a remote host to the local hostscp your_username@remote-server:foobar.txt /path/to/local/directoryCopy a local file myfile.txt to remote serverscp myfile.txt your_username@remote-server:/path/to/copy/Copy the directory "mydir" from the local host to a remote host's directory "myremotedir"scp -r mydir your_username@remote-server:/path/to/remote/directory/myremotedirsftpThis can be used for doing file transfer using secure ftp protocol. To open a sftp command prompt on a sftp server try thissftp your_username@remote-servercatUsed to display the content of the file on console without opening it in a editor..cat myfilemoreUsed to display the content of a file on console with option to navigate in case the content is too large to fit in screen.more myfilefindFind a file or directory on the system using this command Find a file myfile.txt in current directory and its subdirectories. find . -name “myfile.txt” Find all files in Documents directory that are larger that 25MB in size find . -size +25M -exec du -h {} \; Find all .doc files on the system that have been modified in the last 5 days. find . –name “*.doc” –mtime -5 Find all .txt files on the system that were modified in last 15 minutes find . –name “*.txt” –mmin -15 Find all files that contain a string “I am inside file”. find . -name "*" -exec grep -i -H "I am inside file" {} \;grepThis command is used to search all the lines in all files in a specified location containing a string. Search for a specific string “myname” in a file myfile.txt grep “myname” myfile.txt Search for a specific string “myname” with ignoring the case in a file myfile.txt grep -i “myname” myfile.txt Search for a specific string “myname” in a all files in current directory grep “myname” * Search for full word “myword” in a file myfile.txt grep -w “myword” myfile.txt Search a string “myname” in all files in all subdirectories recursively grep -r “myname” *rmRemove a file or directory using this commandRemove a file name myfile.txtrm myfile.txtRemove a directory mydirrm -r mydirRemove a file myfile.txt forcefullyrm -f myfile.txtchmodThe command for manipulating the file permissionsFor better security, the permissions for file in Linux OS are categorized into different groups, users and other sections. You have the option of controlling the permissions by assigning the users under the given divisions via the command of ‘chmod’. These permissions would help the users to write, read and execute the respective files. This option is very much handy when you have to run a script in order to install the package, which remains non executable in the default for security reasons. With the command of ‘chmod +x’ you could end up making the script executable over your Linux system. Provide execute permission on a file myfile.txt to all users chmod +x myfile.txt Provide read permission on a file myfile.txt to all users chmod +r myfile.txt Provide full permissions (read/write/execute) on a file myfile.txt to yourself but everyone else has only read and execute chmod 755 myfile.txt Provide full permissions (read/write/execute) on a file myfile.txt to everyone chmod 777 myfile.txtchownChange ownership of a file. You should be either root or the owner of the file to successfully run this command.Change the ownership of a file myfile.txt to another_user who is part of another_groupchown another_user:another_group myfile.txtChange the ownership of a directory mydir1 recursively to another_user who is part of another_groupchown -R another_user:another_group mydir1Other Useful CommandspasswdThis is the command for changing the password. Passwords play an important role in securing your data found in your desktop computer. In order to keep the system full proof against the hacking attacks, you need to keep on changing your passwords every three months. The users over Linux computers could do the same using a particular command of ‘change password’ over the command prompt and do the needful. After you type the command, all you need to do is to type the new password twice, and you are done with the same.logoutCommand for logging out. By typing this command, you would be logged out from your Linux based computer. This command will help in disconnecting from your Linux based PCs or simply help in logging out the session that you are seen over your desktop. All you need to do is to remember the account you have logged out as it may bring a couple of security issues. Hence it is highly suggested to use a log out the moment you finish your task over your PC.kill -9The command to terminate the process by its process id. You may find certain Linux applications not responding at such junctures, you could simply get away from this scenario by typing the kill command, which will help in terminating the process. For this you need the process ‘PID’ of the particular application, which could be done with the help of “ps” command. You could further use this command to kill the command to terminate the application, which is not responding.Terminate a process with with ID 1234kill -9 1234”>” - The operator to redirect outputThough this may not be called as a command by many yet it is among the important steps to master while you start working with Linux over the command line. For this you need several tools, which also include the pipe. These help in redirecting the output (that is often printed over the screen) somewhere else like the text file or any other application. This command is used to complete any file over the Linux system. Copy content of file1 to file2 cat file1 > file2 Append content of file1 to file2 cat file1>>file2 Create a new file myfile.txt with text “some text” echo “some text” > myfile.txtpipe (|) operatorThe pipe operator is a powerful operator that can be used to join two commands together. Usign this operator output of one command can become input to another command. For example Display live occurrence of text “myname” in a file myfile.log tail -f myfile.logs | grep “myname” Count the number of lines in a file myfile1 cat myfile1 | wc -l Find all running java processes on a system ps -aef | grep “java” Find all .txt files containing text “myname” find . -name “*.txt” | xargs grep “myname”historyThis is the command for recall.You need to use history to rerun any command. If you enter this command without any kind of switch, you end up getting the history list along with the line numbers. Also, you could even perform some additional search of the given history list with this command.exitUse this to quit the command line shell on a linux system.Tutorial by sleed, from RST. Quote
bcman Posted February 2, 2014 Report Posted February 2, 2014 Dac? tot faci copy/paste, mac?r nu-l prezenta ca fiind al t?u.30 Essential Linux Basic Commands You Must Know | FromDev Quote
nacks Posted February 2, 2014 Report Posted February 2, 2014 ... poate cineva are nevoie de: "Linux Complete Command Reference"Download Linux Complete Command Reference Quote
Guest Kovalski Posted February 2, 2014 Report Posted February 2, 2014 Ce ai pus matale aici e fix cucu, uite aici o lista completa de comenzi plus explicatii pentru fiecare comanda.https://docs.google.com/document/d/1M3RYJwF-0zUy1iiCBI2OEKU15e_AYajOkyv9xjETOh8/edit#Sunt culese de mine de-a lungul vremii si nici nu mai am idee de prin ce carti le-am adunat. Quote