Tag Info

Hot answers tagged

125

The correct syntax, which returns the same output, would be: ps u There is a good reason why modern syntax for ps is a mess. Historically, there were two incompatible version of ps. Options with a leading dash were inherited from the AT&T Unix version of ps. Options without a leading dash were inherited from BSD. The version of ps that Linux ...


84

The ps command historically had wildly different syntax in BSD and System V Unix. In BSD ps, the u option (no dash) takes no parameter and shows the "user-oriented output" with the additional columns. In SunOS ps, the -u option (with dash) takes a username as parameter and only includes processes owned by that user, but without changing the display format. ...


35

There are two things you need to do: Make sure the file is executable: chmod +x script.py Use a shebang to let the kernel know what interpreter to use. The top line of the script should read: #!/usr/bin/python This assumes that your script will run with the default python. If you need a specific version, just specify in the shebang: ...


25

Under linux you can simply use the hashbang(aka shebang). Add the line #!/usr/bin/python if you want to execute the default python interpreter. #!/path/to/python[x.x] to use some specific version, or #!/usr/bin/env python If you want the environment to find python for you. You will also be required to make the script executable chmod +x ...


19

The difference is big-endian vs. little-endian order. Start with the first four bytes of hexdump output: ac5a 5afb. Now switch the byte order to get: 5aac fb5a Compare this with the PHP output: 5aac fb5a They match. By default, BSD hexdump displays output based on the machine's endianness. If you don't want that, you can specify the -C option to ...


16

An alternative for debian squeeze without fetching packages from wheezy: Use LTS security repo that has the patch backported. Add this to /etc/apt/sources.list: #LTS security deb http://http.debian.net/debian/ squeeze-lts main contrib non-free deb-src http://http.debian.net/debian/ squeeze-lts main contrib non-free Then run apt-get update && ...


8

0000 was considered ambiguous, since it might just mean 000, plus a leading zero since it's octal. http://lists.gnu.org/archive/html/bug-coreutils/2011-03/msg00162.html 0755 is not explicit - it is ambiguous with people that are explicitly using printf %#3o to output a 3-digit octal string with leading 0 - I don't think we can change this. That ...


8

Commands entered with a leading space are typically not stored in bash's history. This is a feature: if you want bash not to put a command in history, such as a dangerous command like rm -rf ..., place a space in front of it. Also, duplicate commands may be ignored. This behavior is configurable with the HISTCONTROL variable. From man bash: ...


8

The main ideas before you dive into some guides if you feel like it to learn more details: What is It's a special type of partition (sometimes OSes simply use one giant swap file). What is for The swap partition is used by an OS to artificially increase the size of the memory. When should I use When you think that the size of your physical ...


7

No worries, all is fine: -v --verbose Verbose. Display the name and percentage reduction for each file compressed or decompressed. So, you're seeing how much the file was compressed, not some progress of the action itself. It can even show negative values. Like if you wanted to test for yourself, and for that first generate a binary test file with ...


7

Selinux is for enforcing process types. This is not the same as user isolation. For a really simple guide to understanding SELinux, take a look at the SELinux coloring book (yes it really is a coloring book). https://people.redhat.com/duffy/selinux/selinux-coloring-book_A4-Stapled.pdf For a workstation, SELinux isn't as important as on a server. However ...


7

I'd go with Screen. Installation can be done via apt-get. Afterwards you just type screen in the prompt, start a process (even without sending it to background), close the session, and the process still keeps running. To re-attatch to the screen-session, you just ssh back into the machine and type screen -r. You can also detatch from the active screen by ...


6

Without a source machine to copy permissions from, wether programmatically or by hand (yeah, right), you are up the virtual creek without a paddle. The best you can do is hope for a tar backup that you took and forgot about to recreate permissions from. Even copying permissions from a proper source system will likely not bring things back to perfect ...


5

The salt and the encrypted password are both mashed into the string YtChlvAGYzva2. From the Shadow Password Howto: When a user picks or is assigned a password, it is encoded with a randomly generated value called the salt. This means that any particular password could be stored in 4096 different ways. The salt value is then stored with the encoded ...


5

You're using the source command wrong. I'm assuming you have a file called myscript that contains these commands. Instead of having stuff to generate the right commands in the file, like this echo 'alias foo="bar -param"' you should just have the commands, like this alias foo="bar -param" Then you pass your script directly to the source command, which ...


5

Source fg Send job to foreground fg Send job to foreground Syntax fg [PID...] Options: If PID is specified, the job with the specified group id is put in the foreground. Send the specified job to the foreground. While a foreground job is executed, fish is suspended. If no job is specified, the last job to be used ...


4

You can configure both the OSes to ask for static IPs instead of the router assigning static IP addresses based on their MAC addresses. This can be achieved by configuring the respective operating systems' network settings, and have both of them ask for different static IPs. In Windows, these settings can be found in Network and Sharing Center. In Linux ...


4

If you have your user and group rights setup properly, you should not be concerned about other regular users. SELinux is meant to protect you from the irregularities, i.e. someone taking advantage of program or configuration faults to make your computer do something that is not in your interest. This could be using networking daemons running on your ...


4

Use this pipe: echo | openssl s_client -connect host:port | openssl x509 -text -noout The command openssl s_client will perform the SSL handshake with the host and print out the certificate as a string in PEM format (among other things). The openssl x509 will convert this certificate string into a human-readable form. The echo is just there to trigger ...


4

Use this: sed "s/\.pro\.net//g" file First, you don't need cat for that, second, make sure to use \. instead of just ., because dot means match any symbol. It may appear to work, but it would also match string xproynet, which is probably not what you want.


4

The pstree is a very good solution, but it is a little bit reticent. I use ps --forest instead. But not for a PID (-p) because it prints only the specific process, but for the session (-g). It can print out any information ps can print in a fancy ASCII art tree defining the -o option. So my suggestion for this problem: ps --forest -o pid,tty,stat,time,cmd ...


4

apt-get update before apt-get dist-upgrade and you will get the patch. Just did it myself and there was a bash upgrade pushed which fixes the problem.


3

I fix in my hackintosh $ brew install bash $ x='() { :;}; echo vulnerable' bash bash: warning: x: ignoring function definition attempt bash: error importing function definition for `x' bash-4.3$


3

I know this is not the answer you wanted since it does not relates to sed but you can use tail in the same way you want, just doing: tail -n <lines> <file> > <new_file> mv new_file file


3

You get a success because the regex matches on a portion of it. If you want an exact match, you need to anchor the pattern to the start and end of the line: regex="^lo(lo)+ba$" the ^ stands for the start of the string: nothing can be before the pattern the $ stands for the end of the string: nothing can be after In your original code, as the pattern is ...


3

It requires to understand the linux booting mechanism a little bit better. After booting, the kernel initializes the device drivers, and after that it starts the first process on the system. By default, it is /sbin/init. From this point, the kernel doesn't do anything by own, only executes the requests of the processes. You can override this default ...


3

You don't need to tell bash to wait if the processes you're executing run in the foreground (which everything you show above does) - it will block waiting for them to exit. Once they exit, bash can examine the return code and behave differently based on that. The return code of the last subprocess is stored in the $? variable: #!/bin/bash yum update if ...


3

Each process has it's own FD - table (see http://en.wikipedia.org/wiki/File_descriptor ), otherwise process A would have to communicate with process B about the filedescriptors (and not only with B but also with all the other processes on the machine). So, just knowing the (internal) FD is not enough, you need to know where this FD points to: $> ls ...


3

If you'd like to see the man(manual) page for a particular command(i.e. tail) man tail press 'q' to exit man pages. or tail --help tail --help | less press 'q' to exit


3

What you need is a static build of FFMPEG. There are probably a lot around. I suggest you http://johnvansickle.com/ffmpeg/, which is advertised on the FFMPEG main site, so is probably reliable. You can download both latest release (2.4.1) and git snapshot. Unless you know what you are doing, use the released version. Also, pay attention to choose correctly ...



Only top voted, non community-wiki answers of a minimum length are eligible